You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnerrors.New("the sum of all bucket populations exceeds the count of observations")
1883
+
}
1884
+
returnnil
1885
+
}
1886
+
1887
+
// NewConstNativeHistogram returns a metric representing a Prometheus native histogram with
1888
+
// fixed values for the count, sum, and positive/negative/zero bucket counts. As those parameters
1889
+
// cannot be changed, the returned value does not implement the Histogram
1890
+
// interface (but only the Metric interface). Users of this package will not
1891
+
// have much use for it in regular operations. However, when implementing custom
1892
+
// OpenTelemetry Collectors, it is useful as a throw-away metric that is generated on the fly
1893
+
// to send it to Prometheus in the Collect method.
1894
+
//
1895
+
// zeroBucket counts all (positive and negative)
1896
+
// observations in the zero bucket (with an absolute value less or equal
1897
+
// the current threshold).
1898
+
// positiveBuckets and negativeBuckets are separate maps for negative and positive
1899
+
// observations. The map's value is an int64, counting observations in
1900
+
// that bucket. The map's key is the
1901
+
// index of the bucket according to the used
1902
+
// Schema. Index 0 is for an upper bound of 1 in positive buckets and for a lower bound of -1 in negative buckets.
1903
+
// NewConstNativeHistogram returns an error if
1904
+
// - the length of labelValues is not consistent with the variable labels in Desc or if Desc is invalid.
1905
+
// - the schema passed is not between 8 and -4
1906
+
// - 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)
1907
+
//
1908
+
// See https://opentelemetry.io/docs/specs/otel/compatibility/prometheus_and_openmetrics/#exponential-histograms for more details about the conversion from OTel to Prometheus.
0 commit comments