aboutsummaryrefslogtreecommitdiff
path: root/plugin/metrics/vars/vars.go
diff options
context:
space:
mode:
authorGravatar Ben Kochie <superq@gmail.com> 2024-03-11 21:09:09 +0100
committerGravatar GitHub <noreply@github.com> 2024-03-11 16:09:09 -0400
commit0d6e113f9036596df3e291028ad9ffbbdca9677e (patch)
tree5abb58200b7e97d55cf773e6519c7c225d888bf1 /plugin/metrics/vars/vars.go
parenta4cbd95795d4d5cd69ddd6628eb254fade3b6037 (diff)
downloadcoredns-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/metrics/vars/vars.go')
-rw-r--r--plugin/metrics/vars/vars.go33
1 files changed, 18 insertions, 15 deletions
diff --git a/plugin/metrics/vars/vars.go b/plugin/metrics/vars/vars.go
index 6de75c044..7b8078509 100644
--- a/plugin/metrics/vars/vars.go
+++ b/plugin/metrics/vars/vars.go
@@ -17,19 +17,21 @@ var (
}, []string{"server", "zone", "view", "proto", "family", "type"})
RequestDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
- Namespace: plugin.Namespace,
- Subsystem: subsystem,
- Name: "request_duration_seconds",
- Buckets: plugin.TimeBuckets,
- Help: "Histogram of the time (in seconds) each request took per zone.",
+ Namespace: plugin.Namespace,
+ 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"})
RequestSize = promauto.NewHistogramVec(prometheus.HistogramOpts{
- Namespace: plugin.Namespace,
- Subsystem: subsystem,
- 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},
+ Namespace: plugin.Namespace,
+ Subsystem: subsystem,
+ 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{
@@ -40,11 +42,12 @@ var (
}, []string{"server", "zone", "view"})
ResponseSize = promauto.NewHistogramVec(prometheus.HistogramOpts{
- Namespace: plugin.Namespace,
- Subsystem: subsystem,
- 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},
+ Namespace: plugin.Namespace,
+ Subsystem: subsystem,
+ 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{