-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add benchmark for map access using attribute Equivalent #7123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dashpole
merged 7 commits into
open-telemetry:main
from
dashpole:attribute_equivalent_bench
Aug 6, 2025
Merged
Add benchmark for map access using attribute Equivalent #7123
dashpole
merged 7 commits into
open-telemetry:main
from
dashpole:attribute_equivalent_bench
Aug 6, 2025
Conversation
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
pellared
approved these changes
Aug 4, 2025
MrAlias
reviewed
Aug 4, 2025
|
flc1125
approved these changes
Aug 6, 2025
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Flc゛ <four_leaf_clover@foxmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7123 +/- ##
=====================================
Coverage 82.9% 82.9%
=====================================
Files 262 262
Lines 24461 24461
=====================================
+ Hits 20291 20294 +3
+ Misses 3794 3791 -3
Partials 376 376 🚀 New features to boost your workflow:
|
dashpole
commented
Aug 6, 2025
MrAlias
approved these changes
Aug 6, 2025
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.
I am looking into I am looking into https://promlabs.com/blog/2025/07/17/why-i-recommend-native-prometheus-instrumentation-over-opentelemetry/#comparing-counter-increment-performance, and was trying to figure out why incrementing a counter with 10 attributes was so much slower than incrementing a counter with no attributes, or 1 attribute:
Looking at the profile, most of the time is spent in "runtime.mapKeyError2" within "runtime.mapaccess2". My best guess is that whatever we are using for Equivalent() is not very performant when used as a map key. This seems like a good opportunity to greatly improve the performance of our metrics (and probably other signals) API + SDK.
To start, i'm adding a simple benchmark within the attribute package to isolate the issue. Results:
This shows that it is the map lookup and storage itself that is making the metrics API+SDK perform much worse with more attributes.
Some optimization ideas include: