@@ -148,42 +148,6 @@ In the text format, Prometheus histograms buckets, count and sum are sent as sep
148148* If ` _count ` is not present, the metric MUST be dropped.
149149* If ` _sum ` is not present, the histogram's sum MUST be unset.
150150
151- A [ Prometheus Native Histogram with Custom Buckets] ( https://prometheus.io/docs/specs/native_histograms/#custom-values )
152- (NHCB) that has schema -53 and which are of the integer and counter [ flavor] ( https://prometheus.io/docs/specs/native_histograms/#flavors )
153- MUST be converted to an OTLP Histogram as follows:
154-
155- - If the Native Histogram ` ResetHint ` (or ` CounterResetHint ` ) indicates gauge
156- type, the native histogram MUST be dropped. Otherwise this field is ignored.
157- - The ` NoRecordedValue ` flag is set to ` true ` if the ` Sum ` is equal to the
158- [ Stale NaN value] ( https://github.com/prometheus/prometheus/blob/main/model/value/value.go ) .
159- Otherwise,
160- - ` Count ` is converted to Histogram ` Count ` . Note that the ` Count `
161- is equal to the sum of all bucket counts.
162- - ` Sum ` is converted to the Histogram ` Sum ` . Note that the ` Sum `
163- may be ` NaN ` in case the Native Histogram observed the value ` NaN ` or both
164- ` -Inf ` and ` +Inf ` . The ` Sum ` may also be ` -Inf ` or ` +Inf ` .
165- - ` Timestamp ` is converted to the Histogram ` TimeUnixNano ` after
166- converting milliseconds to nanoseconds.
167- - ` Min ` and ` Max ` are not set.
168- - [ ` CustomValues ` ] ( https://prometheus.io/docs/specs/native_histograms/#custom-values )
169- is converted to bucket boundaries. The ` +Inf ` bucket is implicit, in the same way
170- as in OTLP Histograms.
171- - The [ sparse bucket layout] ( https://prometheus.io/docs/specs/native_histograms/#buckets )
172- represented by ` PositiveSpans ` and ` PositiveDeltas ` is converted to
173- Histogram bucket counts.
174-
175- - The ` PositiveDeltas ` are delta encoded bucket counts, where the first value
176- is an absolute bucket count and each subsequent value is a delta to the
177- previous value.
178- - The ` PositiveSpans ` encode the index into the bucket counts for each value
179- in the ` PositiveDeltas ` . The index starts from the ` Offset ` in the first
180- span and for subsequent spans the span's ` Offset ` is added to the previous
181- index. The span's ` Length ` indicates the number of continuous indexes to
182- use.
183-
184- - ` StartTimeUnixNano ` is set to the ` Start Timestamp ` , if available.
185- - ` AggregationTemporality ` is set to ` cumulative ` .
186-
187151### Native Histograms
188152
189153** Status** : [ Development] ( ../document-status.md )
@@ -194,7 +158,7 @@ of the integer and counter [flavor](https://prometheus.io/docs/specs/native_hist
194158MUST be converted to an OTLP Exponential Histogram as follows:
195159
196160- If the Native Histogram ` ResetHint ` (or ` CounterResetHint ` ) indicates gauge
197- type, the native histogram MUST be dropped. Otherwise this field is ignored.
161+ type, the native histogram is dropped. Otherwise this field is ignored.
198162- ` Schema ` is converted to the Exponential Histogram ` Scale ` .
199163- The ` NoRecordedValue ` flag is set to ` true ` if the ` Sum ` is equal to the
200164 [ Stale NaN value] ( https://github.com/prometheus/prometheus/blob/main/model/value/value.go ) .
@@ -239,6 +203,42 @@ MUST be converted to an OTLP Exponential Histogram as follows:
239203- ` StartTimeUnixNano ` is set to the ` Start Timestamp ` timestamp, if available.
240204- ` AggregationTemporality ` is set to ` cumulative ` .
241205
206+ A Native histogram with custom buckets (NHCB) schema (i.e. schema -53) and which
207+ are of the integer and counter [ flavor] ( https://prometheus.io/docs/specs/native_histograms/#flavors )
208+ MUST be converted to an OTLP Histogram as follows:
209+
210+ - If the Native Histogram ` ResetHint ` (or ` CounterResetHint ` ) indicates gauge
211+ type, the native histogram is dropped. Otherwise this field is ignored.
212+ - The ` NoRecordedValue ` flag is set to ` true ` if the ` Sum ` is equal to the
213+ [ Stale NaN value] ( https://github.com/prometheus/prometheus/blob/main/model/value/value.go ) .
214+ Otherwise,
215+ - ` Count ` is converted to Histogram ` Count ` . Note that the ` Count `
216+ is equal to the sum of all bucket counts.
217+ - ` Sum ` is converted to the Histogram ` Sum ` . Note that the ` Sum `
218+ may be ` NaN ` in case the Native Histogram observed the value ` NaN ` or both
219+ ` -Inf ` and ` +Inf ` . The ` Sum ` may also be ` -Inf ` or ` +Inf ` .
220+ - ` Timestamp ` is converted to the Histogram ` TimeUnixNano ` after
221+ converting milliseconds to nanoseconds.
222+ - ` Min ` and ` Max ` are not set.
223+ - [ ` CustomValues ` ] ( https://prometheus.io/docs/specs/native_histograms/#custom-values )
224+ is converted to bucket boundaries. The ` +Inf ` bucket is implicit, therefore
225+ ` N ` ` CustomValues ` represent ` N+1 ` Histogram bucket counts.
226+ - The [ sparse bucket layout] ( https://prometheus.io/docs/specs/native_histograms/#buckets )
227+ represented by ` PositiveSpans ` and ` PositiveDeltas ` is converted to
228+ Histogram bucket counts.
229+
230+ - The ` PositiveDeltas ` are delta encoded bucket counts, where the first value
231+ is an absolute bucket count and each subsequent value is a delta to the
232+ previous value.
233+ - The ` PositiveSpans ` encode the index into the bucket counts for each value
234+ in the ` PositiveDeltas ` . The index starts from the ` Offset ` in the first
235+ span and for subsequent spans the span's ` Offset ` is added to the previous
236+ index. The span's ` Length ` indicates the number of continuous indexes to
237+ use.
238+
239+ - ` StartTimeUnixNano ` is set to the ` Start Timestamp ` , if available.
240+ - ` AggregationTemporality ` is set to ` cumulative ` .
241+
242242Native histograms of the float or gauge flavors MUST be dropped.
243243
244244Native Histograms with ` Schema ` outside of the range [ -4, 8] and not equal to
0 commit comments