Skip to content
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

MetricRefactor - Part1 - Move AttributeSet inside aggregations #1977

Merged

Conversation

cijothomas
Copy link
Member

Part 1 of metric sdk refactor to achieve perf gains and no-heap-allocation. The heap allocation and perf cost is due to the usage of AttributeSet which clones and stores the incoming slice of KV pairs, after sorting + de-duplicating, which can be eliminated.

This PR modifies traits to only need &[KeyValue] (which is what API accepts from user) instead of AttributeSet. There is no perf gain in this PR, as the AttributeSet is still constructed inside each aggregations. This is done to keep the scope of PR very small, and easy to review.
In the next PR, Sum aggregation will be targeted to achieve the perf gains and no-heap alloc, later extending to other instruments.

@cijothomas cijothomas requested a review from a team July 31, 2024 17:47
Copy link

codecov bot commented Jul 31, 2024

Codecov Report

Attention: Patch coverage is 87.23404% with 6 lines in your changes missing coverage. Please review.

Project coverage is 74.8%. Comparing base (cfbd1c3) to head (7a38c79).

Files Patch % Lines
opentelemetry-sdk/src/metrics/mod.rs 0.0% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1977     +/-   ##
=======================================
- Coverage   74.9%   74.8%   -0.1%     
=======================================
  Files        122     122             
  Lines      20411   20429     +18     
=======================================
+ Hits       15296   15298      +2     
- Misses      5115    5131     +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@utpilla utpilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Left some suggestions.

Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. These seems to be all internal changes, so no changelog required.

@cijothomas cijothomas merged commit ac7343f into open-telemetry:main Jul 31, 2024
25 checks passed
@cijothomas cijothomas deleted the cijothomas/metric-refactor-1 branch July 31, 2024 23:48
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.

3 participants