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:
parent
a4cbd95795
commit
0d6e113f90
7 changed files with 55 additions and 42 deletions
|
@ -26,6 +26,7 @@ var (
|
|||
Subsystem: "grpc",
|
||||
Name: "request_duration_seconds",
|
||||
Buckets: plugin.TimeBuckets,
|
||||
NativeHistogramBucketFactor: plugin.NativeHistogramBucketFactor,
|
||||
Help: "Histogram of the time each request took.",
|
||||
}, []string{"to"})
|
||||
)
|
||||
|
|
|
@ -71,6 +71,7 @@ var (
|
|||
Subsystem: "health",
|
||||
Name: "request_duration_seconds",
|
||||
Buckets: plugin.SlimTimeBuckets,
|
||||
NativeHistogramBucketFactor: plugin.NativeHistogramBucketFactor,
|
||||
Help: "Histogram of the time (in seconds) each request took.",
|
||||
})
|
||||
// HealthFailures is the metric used to count how many times the health request failed
|
||||
|
|
|
@ -21,6 +21,7 @@ var (
|
|||
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"},
|
||||
)
|
||||
|
@ -33,6 +34,7 @@ var (
|
|||
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"},
|
||||
)
|
||||
|
|
|
@ -30,6 +30,7 @@ var (
|
|||
Name: "dns_programming_duration_seconds",
|
||||
// From 1 millisecond to ~17 minutes.
|
||||
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"})
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ var (
|
|||
Subsystem: subsystem,
|
||||
Name: "request_duration_seconds",
|
||||
Buckets: plugin.TimeBuckets,
|
||||
NativeHistogramBucketFactor: plugin.NativeHistogramBucketFactor,
|
||||
Help: "Histogram of the time (in seconds) each request took per zone.",
|
||||
}, []string{"server", "zone", "view"})
|
||||
|
||||
|
@ -30,6 +31,7 @@ var (
|
|||
Name: "request_size_bytes",
|
||||
Help: "Size of the EDNS0 UDP buffer in bytes (64K for TCP) per zone and protocol.",
|
||||
Buckets: []float64{0, 100, 200, 300, 400, 511, 1023, 2047, 4095, 8291, 16e3, 32e3, 48e3, 64e3},
|
||||
NativeHistogramBucketFactor: plugin.NativeHistogramBucketFactor,
|
||||
}, []string{"server", "zone", "view", "proto"})
|
||||
|
||||
RequestDo = promauto.NewCounterVec(prometheus.CounterOpts{
|
||||
|
@ -45,6 +47,7 @@ var (
|
|||
Name: "response_size_bytes",
|
||||
Help: "Size of the returned response in bytes.",
|
||||
Buckets: []float64{0, 100, 200, 300, 400, 511, 1023, 2047, 4095, 8291, 16e3, 32e3, 48e3, 64e3},
|
||||
NativeHistogramBucketFactor: plugin.NativeHistogramBucketFactor,
|
||||
}, []string{"server", "zone", "view", "proto"})
|
||||
|
||||
ResponseRcode = promauto.NewCounterVec(prometheus.CounterOpts{
|
||||
|
|
|
@ -14,6 +14,7 @@ var (
|
|||
Subsystem: "proxy",
|
||||
Name: "request_duration_seconds",
|
||||
Buckets: plugin.TimeBuckets,
|
||||
NativeHistogramBucketFactor: plugin.NativeHistogramBucketFactor,
|
||||
Help: "Histogram of the time each request took.",
|
||||
}, []string{"proxy_name", "to", "rcode"})
|
||||
|
||||
|
|
|
@ -108,5 +108,9 @@ var TimeBuckets = prometheus.ExponentialBuckets(0.00025, 2, 16) // from 0.25ms t
|
|||
// SlimTimeBuckets is low cardinality set of duration buckets.
|
||||
var SlimTimeBuckets = prometheus.ExponentialBuckets(0.00025, 10, 5) // from 0.25ms to 2.5 seconds
|
||||
|
||||
// NativeHistogramBucketFactor controls the resolution of Prometheus native histogram buckets.
|
||||
// See: https://pkg.go.dev/github.com/prometheus/client_golang@v1.19.0/prometheus#section-readme
|
||||
var NativeHistogramBucketFactor = 1.05
|
||||
|
||||
// ErrOnce is returned when a plugin doesn't support multiple setups per server.
|
||||
var ErrOnce = errors.New("this plugin can only be used once per Server Block")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue