opentelemetry-go
opentelemetry-go copied to clipboard
OTel Exponential Histogram implementation
The implementation originally shown in #2393 used to finalize the OpenTelemetry specification and was split into parts to begin reviewing in pieces. The mapping functions were merged in #2502, and this is the corresponding data structure.
This data structure has been reviewed by Lightstep engineers and is running in production at Lightstep (i.e., for internal use). This code and the associated metrictransform logic (forked from upstream) is currently released at https://github.com/lightstep/otel-launcher-go/tree/v1.8.0/lightstep/sdk/metric/aggregator/histogram.
This code will be used to revive the OTel Collector statsd receiver: https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/6666.
Fixes #3027. Part of #2966. Related to #2501 and #2502.
~This needs a bit more factoring work. I will move the lock out of the structure and add a Swap method to replace Move (requested by @paivagustavo).~
Because this uses Go-1.18 features, it makes sense to merge this to the new_sdk/main branch. OTOH, we have sdk/metric/aggregator/exponential/mapping already in place, and this builds on that work. If I change this branch to merge into new_sdk/main, I will have to copy the existing sdk/metric/aggregator/exponential/mapping code into that branch as well.
This will fix #3027.
~Needs to incorporate a tiny fix: https://github.com/lightstep/otel-launcher-go/pull/238~
I believe this is blocked until #3081 merges, since it depends on Go-1.18+ and cannot build with 1.17. Otherwise, ready to review.
Codecov Report
Merging #3022 (9296a28) into main (55b49c4) will increase coverage by
0.7%. The diff coverage is96.9%.
Additional details and impacted files
@@ Coverage Diff @@
## main #3022 +/- ##
=======================================
+ Coverage 76.2% 77.0% +0.7%
=======================================
Files 179 182 +3
Lines 11953 12376 +423
=======================================
+ Hits 9117 9531 +414
- Misses 2596 2601 +5
- Partials 240 244 +4
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...ic/aggregator/exponential/structure/exponential.go | 96.5% <96.5%> (ø) |
|
| .../metric/aggregator/exponential/structure/config.go | 100.0% <100.0%> (ø) |
|
| ...dk/metric/aggregator/exponential/structure/test.go | 100.0% <100.0%> (ø) |
|
| sdk/trace/batch_span_processor.go | 81.9% <0.0%> (+1.7%) |
:arrow_up: |
Commit e85aad4 was a bit painful because there were many hand-crafted tests that were off-by-one in different ways after the inclusivity change #2982. I've resolved some of them by changing the inputs (2x) and some of them by subtracting one from the expected values.
There are now slight upstream changes (e.g., an improved comment). https://github.com/lightstep/go-expohisto