-
Notifications
You must be signed in to change notification settings - Fork 446
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
Optimize Metric Processing for Single Collector with Delta Temporality #3236
base: main
Are you sure you want to change the base?
Optimize Metric Processing for Single Collector with Delta Temporality #3236
Conversation
✅ Deploy Preview for opentelemetry-cpp-api-docs canceled.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3236 +/- ##
==========================================
+ Coverage 87.78% 87.80% +0.02%
==========================================
Files 198 198
Lines 6308 6324 +16
==========================================
+ Hits 5537 5552 +15
- Misses 771 772 +1
|
if (collectors.size() == 1 && collector->GetAggregationTemporality( | ||
instrument_descriptor_.type_) == AggregationTemporality::kDelta) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: use the aggregation_temporarily
local variable, from the previous line, in the if test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks done.
return true; | ||
}); | ||
|
||
return callback(metric_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea if this can happen or not, does the code in the fast path needs to pay attention to previous metrics in unreported_metrics_
?
If not, consider to add a comment to explain why, and/or an assert to make sure there are no unreported metrics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fast-path doesn't need to consider the unreported_metrics, I have added comments to make it clear.
This introduces a fast path for cases with a single collector/reader using delta temporality. It skips unnecessary intermediate processing and directly generates metrics for callback, reducing memory usage and CPU overhead. This change is supposed to improve performance for common single-collector scenarios while retaining existing functionality for other cases.
Changes
Please provide a brief description of the changes here.
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes