Use low precision Clock#now when computing timestamp for exemplars#6417
Merged
jack-berg merged 3 commits intoopen-telemetry:mainfrom May 1, 2024
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6417 +/- ##
============================================
- Coverage 91.12% 91.11% -0.01%
- Complexity 5856 5868 +12
============================================
Files 636 636
Lines 17062 17082 +20
Branches 1733 1741 +8
============================================
+ Hits 15548 15565 +17
- Misses 1019 1021 +2
- Partials 495 496 +1 ☔ View full report in Codecov by Sentry. |
trask
approved these changes
May 1, 2024
| this.attributes = attributes; | ||
| // Note: It may make sense in the future to attempt to pull this from an active span. | ||
| this.recordTime = clock.now(); | ||
| // High precision time is not worth the additional performance expense it incurs for exemplars |
Contributor
|
what JVM version were you using to benchmark with? (not that it matters much..but might be nice to include in the PR description for posterity). |
Member
Author
Updated! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #6403.
Introduces a new
Clock#now(boolean highPrecision)overload, which uses a performance optimized millisecond precision whenhighPrecision=false. UpdatesReservoirCellto obtain measurement times usingClock#now(false), which shaves a good chunk of time off the time to record each exemplar (~50ns on my machine).This has a greater impact the more frequent measurements are candidates to be stored in ReservoirCell. The savings are especially impactful for the histogram exemplar reservoir, where the algorithm requires us to take the last measurement for each bucket. This means we compute the time for every measurement recorded.
Here's a benchmark output comparing the high precision and low precision
Clock#nowimplementations. Benchmark run usingOpenJDK Runtime Environment Temurin-17.0.3+7.