mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
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>
This commit is contained in:
@@ -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"},
|
||||
)
|
||||
|
||||
@@ -29,8 +29,9 @@ var (
|
||||
Subsystem: "kubernetes",
|
||||
Name: "dns_programming_duration_seconds",
|
||||
// From 1 millisecond to ~17 minutes.
|
||||
Buckets: prometheus.ExponentialBuckets(0.001, 2, 20),
|
||||
Help: "Histogram of the time (in seconds) it took to program a dns instance.",
|
||||
Buckets: prometheus.ExponentialBuckets(0.001, 2, 20),
|
||||
NativeHistogramBucketFactor: plugin.NativeHistogramBucketFactor,
|
||||
Help: "Histogram of the time (in seconds) it took to program a dns instance.",
|
||||
}, []string{"service_kind"})
|
||||
|
||||
// DurationSinceFunc returns the duration elapsed since the given time.
|
||||
|
||||
Reference in New Issue
Block a user