mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-05 17:27:51 +00:00
Fix metric unregistered
This commit is contained in:
parent
74ba84b76e
commit
966ef227fe
1 changed files with 6 additions and 4 deletions
|
|
@ -23,6 +23,8 @@ import (
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
|
||||||
|
"k8s.io/component-base/metrics"
|
||||||
|
"k8s.io/component-base/metrics/legacyregistry"
|
||||||
"sigs.k8s.io/prometheus-adapter/pkg/client"
|
"sigs.k8s.io/prometheus-adapter/pkg/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -30,18 +32,18 @@ var (
|
||||||
// queryLatency is the total latency of any query going through the
|
// queryLatency is the total latency of any query going through the
|
||||||
// various endpoints (query, range-query, series). It includes some deserialization
|
// various endpoints (query, range-query, series). It includes some deserialization
|
||||||
// overhead and HTTP overhead.
|
// overhead and HTTP overhead.
|
||||||
queryLatency = prometheus.NewHistogramVec(
|
queryLatency = metrics.NewHistogramVec(
|
||||||
prometheus.HistogramOpts{
|
&metrics.HistogramOpts{
|
||||||
Name: "cmgateway_prometheus_query_latency_seconds",
|
Name: "cmgateway_prometheus_query_latency_seconds",
|
||||||
Help: "Prometheus client query latency in seconds. Broken down by target prometheus endpoint and target server",
|
Help: "Prometheus client query latency in seconds. Broken down by target prometheus endpoint and target server",
|
||||||
Buckets: prometheus.ExponentialBuckets(0.0001, 2, 10),
|
Buckets: prometheus.ExponentialBuckets(0.01, 2, 10),
|
||||||
},
|
},
|
||||||
[]string{"endpoint", "server"},
|
[]string{"endpoint", "server"},
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
prometheus.MustRegister(queryLatency)
|
legacyregistry.MustRegister(queryLatency)
|
||||||
}
|
}
|
||||||
|
|
||||||
// instrumentedClient is a client.GenericAPIClient which instruments calls to Do,
|
// instrumentedClient is a client.GenericAPIClient which instruments calls to Do,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue