Skip to content

Commit

Permalink
Add optional Zero Threshold for Exponential Histograms
Browse files Browse the repository at this point in the history
This is a field that exists and is used in Prometheus Exponential
Histograms and it would be nice to include it in OTel Exponential
Histograms as well.

You can see the reference implementation here:
https://github.com/prometheus/prometheus/blob/5937b4f5d4f658758f4aa6b9ab803f022e6e5497/model/histogram/float_histogram.go#L186-L197
https://github.com/prometheus/prometheus/blob/5937b4f5d4f658758f4aa6b9ab803f022e6e5497/model/histogram/float_histogram.go#L770-L790

Signed-off-by: Goutham Veeramachaneni <[email protected]>
  • Loading branch information
gouthamve committed Jul 15, 2022
1 parent 6ce6220 commit dbb4cff
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions specification/metrics/data-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,14 +643,22 @@ perfect subsetting.
| 6 | 1.68179 | 2**(6/8) |
| 7 | 1.83401 | 2**(7/8) |

#### Zero Count

The ExponentialHistogram contains a special `zero_count` field
containing the count of values that are either exactly zero or within
the region considered zero by the instrumentation at the tolerated
level of precision. This bucket stores values that cannot be
expressed using the standard exponential formula as well as values
that have been rounded to zero.
#### Zero Count and Zero Threshold

The ExponentialHistogram contains special `zero_count` bucket and an optional
`zero_threshold` fields where `zero_count` contains the count of values whose
absolute value is less than or equal to `zero_threshold`. The precise value
for the `zero_threshold` is arbitrary and not related to the scale.

When `zero_threshold` is unset or `0`, this bucket stores values that cannot
be expressed using the standard exponential formula as well as values that
have been rounded to zero.

Histograms with different `zero_threshold` can still be merged easily by
taking the largest `zero_threshold` of all involved Histograms and merge the
lower buckets of Histograms with a smaller `zero_threshold` into the common
wider zero bucket. In special cases, a wider zero bucket could be used to
limit the total number of populated buckets.

#### Producer Expectations

Expand Down

0 comments on commit dbb4cff

Please sign in to comment.