Skip to content

Commit 141a3ef

Browse files
authored
Add optional Zero Threshold for Exponential Histograms to the metrics data model (#2665)
1 parent be6591f commit 141a3ef

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

specification/metrics/data-model.md

+19-8
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ linkTitle: Data Model
3030
* [ExponentialHistogram](#exponentialhistogram)
3131
+ [Exponential Scale](#exponential-scale)
3232
+ [Exponential Buckets](#exponential-buckets)
33-
+ [Zero Count](#zero-count)
33+
+ [Zero Count and Zero Threshold](#zero-count-and-zero-threshold)
3434
+ [Producer Expectations](#producer-expectations)
3535
- [Scale Zero: Extract the Exponent](#scale-zero-extract-the-exponent)
3636
- [Negative Scale: Extract and Shift the Exponent](#negative-scale-extract-and-shift-the-exponent)
@@ -643,14 +643,25 @@ perfect subsetting.
643643
| 6 | 1.68179 | 2**(6/8) |
644644
| 7 | 1.83401 | 2**(7/8) |
645645

646-
#### Zero Count
646+
#### Zero Count and Zero Threshold
647647

648-
The ExponentialHistogram contains a special `zero_count` field
649-
containing the count of values that are either exactly zero or within
650-
the region considered zero by the instrumentation at the tolerated
651-
level of precision. This bucket stores values that cannot be
652-
expressed using the standard exponential formula as well as values
653-
that have been rounded to zero.
648+
The ExponentialHistogram contains a special `zero_count` bucket and an optional
649+
`zero_threshold` field where `zero_count` contains the count of values whose
650+
absolute value is less than or equal to `zero_threshold`. The precise value
651+
for the `zero_threshold` is arbitrary and not related to the scale.
652+
653+
When `zero_threshold` is unset or `0`, this bucket stores values that cannot
654+
be expressed using the standard exponential formula as well as values that
655+
have been rounded to zero.
656+
657+
Histograms with different `zero_threshold` can still be merged easily by
658+
taking the largest `zero_threshold` of all involved Histograms and merge the
659+
lower buckets of Histograms with a smaller `zero_threshold` into the common
660+
wider zero bucket. If a merged `zero_threshold` is in the middle of a populated
661+
bucket, it needs to be increased to match the upper boundary of the bucket.
662+
663+
In special cases, a wider zero bucket could be used to limit the total number
664+
of populated buckets.
654665

655666
#### Producer Expectations
656667

0 commit comments

Comments
 (0)