2017-05-17 09:37:43 +00:00
|
|
|
/*
|
|
|
|
Copyright 2017 The Kubernetes Authors.
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package openstack
|
|
|
|
|
|
|
|
import "github.com/prometheus/client_golang/prometheus"
|
|
|
|
|
|
|
|
const (
|
2018-02-03 23:44:57 +00:00
|
|
|
openstackSubsystem = "openstack"
|
|
|
|
openstackOperationKey = "cloudprovider_openstack_api_request_duration_seconds"
|
|
|
|
openstackOperationErrorKey = "cloudprovider_openstack_api_request_errors"
|
2017-05-17 09:37:43 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2018-02-03 23:44:57 +00:00
|
|
|
openstackOperationsLatency = prometheus.NewHistogramVec(
|
2017-05-17 09:37:43 +00:00
|
|
|
prometheus.HistogramOpts{
|
2018-02-03 23:44:57 +00:00
|
|
|
Subsystem: openstackSubsystem,
|
|
|
|
Name: openstackOperationKey,
|
2017-05-17 09:37:43 +00:00
|
|
|
Help: "Latency of openstack api call",
|
|
|
|
},
|
|
|
|
[]string{"request"},
|
|
|
|
)
|
|
|
|
|
2018-02-03 23:44:57 +00:00
|
|
|
openstackAPIRequestErrors = prometheus.NewCounterVec(
|
2017-05-17 09:37:43 +00:00
|
|
|
prometheus.CounterOpts{
|
2018-02-03 23:44:57 +00:00
|
|
|
Subsystem: openstackSubsystem,
|
|
|
|
Name: openstackOperationErrorKey,
|
2017-05-17 09:37:43 +00:00
|
|
|
Help: "Cumulative number of openstack Api call errors",
|
|
|
|
},
|
|
|
|
[]string{"request"},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2018-02-03 23:44:57 +00:00
|
|
|
func registerMetrics() {
|
|
|
|
prometheus.MustRegister(openstackOperationsLatency)
|
|
|
|
prometheus.MustRegister(openstackAPIRequestErrors)
|
2017-05-17 09:37:43 +00:00
|
|
|
}
|