From 5204aec563e103fb5d8905911adcbbbba736f777 Mon Sep 17 00:00:00 2001 From: Shivanth Date: Wed, 13 Nov 2024 10:23:28 +0100 Subject: [PATCH] Review comments --- prometheus/histogram.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/prometheus/histogram.go b/prometheus/histogram.go index 726eb0cda..c3ecf48f8 100644 --- a/prometheus/histogram.go +++ b/prometheus/histogram.go @@ -1884,9 +1884,11 @@ func validateCount(sum float64, count uint64, negativeBuckets, positiveBuckets m // index of the bucket according to the used // Schema. Index 0 is for an upper bound of 1 in positive buckets and for a lower bound of -1 in negative buckets. // NewConstNativeHistogram returns an error if -// - the length of labelValues is not consistent with the variable labels in Desc or if Desc is invalid. -// - the schema passed is not between 8 and -4 -// - the sum of counts in all buckets including the zero bucket does not equal the count if sum is not NaN (or exceeds the count if sum is NaN) +// - the length of labelValues is not consistent with the variable labels in Desc or if Desc is invalid. +// - the schema passed is not between 8 and -4 +// - the sum of counts in all buckets including the zero bucket does not equal the count if sum is not NaN (or exceeds the count if sum is NaN) +// +// See https://opentelemetry.io/docs/specs/otel/compatibility/prometheus_and_openmetrics/#exponential-histograms for more details about the conversion from OTel to Prometheus. func NewConstNativeHistogram( desc *Desc, count uint64, @@ -1941,6 +1943,8 @@ func NewConstNativeHistogram( return ret, nil } +// MustNewConstNativeHistogram is a version of NewConstNativeHistogram that panics where +// NewConstNativeHistogram would have returned an error. func MustNewConstNativeHistogram( desc *Desc, count uint64,