aboutsummaryrefslogtreecommitdiff
path: root/plugin/plugin.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/plugin.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/plugin.go')
-rw-r--r--plugin/plugin.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugin/plugin.go b/plugin/plugin.go
index 51f5ba79c..ca5fe0100 100644
--- a/plugin/plugin.go
+++ b/plugin/plugin.go
@@ -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")