diff options
author | 2024-03-11 21:09:09 +0100 | |
---|---|---|
committer | 2024-03-11 16:09:09 -0400 | |
commit | 0d6e113f9036596df3e291028ad9ffbbdca9677e (patch) | |
tree | 5abb58200b7e97d55cf773e6519c7c225d888bf1 /plugin/kubernetes/metrics.go | |
parent | a4cbd95795d4d5cd69ddd6628eb254fade3b6037 (diff) | |
download | coredns-0d6e113f9036596df3e291028ad9ffbbdca9677e.tar.gz coredns-0d6e113f9036596df3e291028ad9ffbbdca9677e.tar.zst coredns-0d6e113f9036596df3e291028ad9ffbbdca9677e.zip |
Enable Prometheus native histograms (#6524)
Add a NativeHistogramBucketFactor parameter to the use of
`NewHistogramVec` in order to enable use of Prometheus Native
Histograms.
This will store automatically computed sparse buckets in CoreDNS.
If a compatible Prometeus requests native histograms this data will
returned instead of the static buckets.
The default factor of 1.05 should provide high quality resolution data.
Signed-off-by: SuperQ <superq@gmail.com>
Diffstat (limited to 'plugin/kubernetes/metrics.go')
-rw-r--r-- | plugin/kubernetes/metrics.go | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/plugin/kubernetes/metrics.go b/plugin/kubernetes/metrics.go index d6927cd98..caebffad6 100644 --- a/plugin/kubernetes/metrics.go +++ b/plugin/kubernetes/metrics.go @@ -16,11 +16,12 @@ var ( // requestLatency measures K8s rest client requests latency grouped by verb and host. requestLatency = promauto.NewHistogramVec( prometheus.HistogramOpts{ - Namespace: plugin.Namespace, - Subsystem: "kubernetes", - Name: "rest_client_request_duration_seconds", - Help: "Request latency in seconds. Broken down by verb and host.", - Buckets: prometheus.DefBuckets, + Namespace: plugin.Namespace, + Subsystem: "kubernetes", + Name: "rest_client_request_duration_seconds", + Help: "Request latency in seconds. Broken down by verb and host.", + Buckets: prometheus.DefBuckets, + NativeHistogramBucketFactor: plugin.NativeHistogramBucketFactor, }, []string{"verb", "host"}, ) @@ -28,11 +29,12 @@ var ( // rateLimiterLatency measures K8s rest client rate limiter latency grouped by verb and host. rateLimiterLatency = promauto.NewHistogramVec( prometheus.HistogramOpts{ - Namespace: plugin.Namespace, - Subsystem: "kubernetes", - Name: "rest_client_rate_limiter_duration_seconds", - Help: "Client side rate limiter latency in seconds. Broken down by verb and host.", - Buckets: prometheus.DefBuckets, + Namespace: plugin.Namespace, + Subsystem: "kubernetes", + Name: "rest_client_rate_limiter_duration_seconds", + Help: "Client side rate limiter latency in seconds. Broken down by verb and host.", + Buckets: prometheus.DefBuckets, + NativeHistogramBucketFactor: plugin.NativeHistogramBucketFactor, }, []string{"verb", "host"}, ) |