opentelemetry-js
opentelemetry-js copied to clipboard
feat: exponential histogram - part 1 - mapping functions
Which problem is this PR solving?
This PR is part 1 in a series of PRs to add exponential histogram support.
Partially Fixes #3324
Short description of the changes
This PR adds the mapping functions that will be used map values to buckets across the range of usable scales. The scales range from -10 to 20 with higher numbers giving higher resolution. These are not user facing, and will be used internally by the ExponentialHistogramAccumulation
to maintain the highest resolution given its max size and range of values observed. The histogram will use the ExponentMapping
for scales [-10, 0] and the LogarithmMapping
for scales [1, 20]. The Accumulation will start out at max resolution (scale 20) and downscale as needed. It's possible to fit the entire floating point range in two buckets at scale -10, which is the minimum size allowed size for the ExponentialHistogramAccumulation
.
This code is heavily based on the Golang reference implementation. For other details see:
For the other PRs in this series see:
You can see all 3 PRs combined in the original draft PR
Type of change
Please delete options that are not relevant.
- [x] New feature (non-breaking change which adds functionality)
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
- [x] Extensive unit testing
- [x] End to end test with the 3 PRs from this series adding ExponentialHistogram support
Checklist:
- [x] Followed the style guidelines of this project
- [x] Unit tests have been added
- [x] Documentation has been updated
Codecov Report
Merging #3504 (94fd188) into main (b5ef0e4) will increase coverage by
0.07%
. The diff coverage is99.12%
.
Additional details and impacted files
@@ Coverage Diff @@
## main #3504 +/- ##
==========================================
+ Coverage 93.80% 93.88% +0.07%
==========================================
Files 249 255 +6
Lines 7640 7754 +114
Branches 1589 1609 +20
==========================================
+ Hits 7167 7280 +113
- Misses 473 474 +1
Impacted Files | Coverage Δ | |
---|---|---|
...ry-instrumentation-grpc/src/grpc-js/clientUtils.ts | 92.85% <ø> (ø) |
|
...elemetry-instrumentation-grpc/src/grpc-js/index.ts | 92.30% <ø> (ø) |
|
...metry-instrumentation-grpc/src/grpc/clientUtils.ts | 89.18% <ø> (ø) |
|
...entelemetry-instrumentation-grpc/src/grpc/index.ts | 93.98% <ø> (ø) |
|
...trics/src/aggregator/exponential-histogram/util.ts | 87.50% <87.50%> (ø) |
|
...r/exponential-histogram/mapping/ExponentMapping.ts | 100.00% <100.00%> (ø) |
|
.../exponential-histogram/mapping/LogarithmMapping.ts | 100.00% <100.00%> (ø) |
|
...egator/exponential-histogram/mapping/getMapping.ts | 100.00% <100.00%> (ø) |
|
...ggregator/exponential-histogram/mapping/ieee754.ts | 100.00% <100.00%> (ø) |
|
.../aggregator/exponential-histogram/mapping/types.ts | 100.00% <100.00%> (ø) |
|
... and 2 more |