mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Metrics: Add ability to disable classic histogram for HTTP metric (#88315)
metrics: Add ability to disable classic histogram for HTTP metric Signed-off-by: Dave Henderson <dave.henderson@grafana.com>
This commit is contained in:
@@ -51,12 +51,19 @@ func RequestMetrics(features featuremgmt.FeatureToggles, cfg *setting.Cfg, promR
|
||||
if features.IsEnabledGlobally(featuremgmt.FlagEnableNativeHTTPHistogram) {
|
||||
// the recommended default value from the prom_client
|
||||
// https://github.com/prometheus/client_golang/blob/main/prometheus/histogram.go#L411
|
||||
// Giving this variable an value means the client will expose the histograms as an
|
||||
// native histogram instead of normal a normal histogram.
|
||||
// Giving this variable a value means the client will expose a native
|
||||
// histogram.
|
||||
histogramOptions.NativeHistogramBucketFactor = 1.1
|
||||
// The default value in OTel. It probably good enough for us as well.
|
||||
histogramOptions.NativeHistogramMaxBucketNumber = 160
|
||||
histogramOptions.NativeHistogramMinResetDuration = time.Hour
|
||||
|
||||
if features.IsEnabledGlobally(featuremgmt.FlagDisableClassicHTTPHistogram) {
|
||||
// setting Buckets to nil with native options set means the classic
|
||||
// histogram will no longer be exposed - this can be a good way to
|
||||
// reduce cardinality in the exposed metrics
|
||||
histogramOptions.Buckets = nil
|
||||
}
|
||||
}
|
||||
|
||||
httpRequestDurationHistogram := prometheus.NewHistogramVec(
|
||||
|
||||
Reference in New Issue
Block a user