Skip to content

Conversation

@dashpole
Copy link
Contributor

@dashpole dashpole commented Oct 6, 2025

PoC of open-telemetry/opentelemetry-specification#4678.

Please only pay attention to 9429757. Previous commits are from #7447 and #7443, and are important for having real performance numbers.

Compared with #7443, this does come with a performance cost according to our benchmarks to track when to record the next measurement:

                           │ fixedsize.txt │               new.txt               │
                           │    sec/op     │    sec/op     vs base               │
HistogramReservoirOffer-24     23.58n ± 4%   36.81n ± 10%  +56.11% (p=0.002 n=6)

The percentage cost increase is large (~50%), but the absolute cost is relatively small (~10ns). This increase is largely because of how the benchmark is written: it benchmarks the first 100 measurements by resetting the count every 100 observations.

If we do not reset storage every 100 observations in the benchmark, the rate of recording exemplars becomes essentially zero. So for histograms with very large numbers of observations, this is actually a substantial performance improvement:

                           │ fixedsize.txt │               new.txt               │
                           │    sec/op     │    sec/op     vs base               │
HistogramReservoirOffer-24    23.580n ± 4%   5.189n ± 14%  -78.00% (p=0.002 n=6)

@codecov
Copy link

codecov bot commented Oct 6, 2025

Codecov Report

❌ Patch coverage is 93.93939% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.7%. Comparing base (a10652b) to head (34911fb).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
sdk/metric/exemplar/fixed_size_reservoir.go 88.6% 4 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #7458   +/-   ##
=====================================
  Coverage   85.7%   85.7%           
=====================================
  Files        284     284           
  Lines      25017   25054   +37     
=====================================
+ Hits       21441   21473   +32     
- Misses      3197    3200    +3     
- Partials     379     381    +2     
Files with missing lines Coverage Δ
sdk/metric/exemplar/histogram_reservoir.go 94.8% <100.0%> (+2.5%) ⬆️
sdk/metric/exemplar/storage.go 96.4% <100.0%> (-3.6%) ⬇️
sdk/metric/exemplar/fixed_size_reservoir.go 95.7% <88.6%> (-2.0%) ⬇️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dashpole
Copy link
Contributor Author

dashpole commented Oct 7, 2025

Closing, as it is just a PoC

@dashpole dashpole closed this Oct 8, 2025
github-merge-queue bot pushed a commit to open-telemetry/opentelemetry-specification that referenced this pull request Oct 28, 2025
…ograms (#4678)

Fixes
#4675

## Changes

Change the recommended algorithm for histogram reservoirs to be
time-unbiased.

I've left the previous algorithm as an option to ensure this change is
backwards-compatible.

Go prototype:
open-telemetry/opentelemetry-go#7458

* [x] Links to the prototypes (when adding or changing features)
* [x]
[`CHANGELOG.md`](https://github.com/open-telemetry/opentelemetry-specification/blob/main/CHANGELOG.md)
file updated for non-trivial changes

---------

Co-authored-by: Tyler Yahn <[email protected]>
Co-authored-by: Carlos Alberto Cortez <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant