-
Notifications
You must be signed in to change notification settings - Fork 438
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
[SDK] Fix Observable Counters/UpDownCounters #2298
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2298 +/- ##
==========================================
- Coverage 87.52% 87.45% -0.06%
==========================================
Files 199 199
Lines 5981 5996 +15
==========================================
+ Hits 5234 5243 +9
- Misses 747 753 +6
|
@@ -159,7 +160,29 @@ class DefaultAggregation | |||
new DoubleSumAggregation(nostd::get<SumPointData>(point_data))); | |||
} | |||
default: | |||
return DefaultAggregation::CreateAggregation(instrument_descriptor, nullptr); | |||
return nullptr; // won't reach here |
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.
Add an assert here?
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, will look into this separately. Not a big fan of adding assert in telemetry sdk. But returning nullptr
(even for unreachable code) is also not nice thing. Probaby we can return DropAggregation just to be cautious. Will create a issue to track this.
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.
Starting review, just a question for now.
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.
LGTM, thanks for the fix.
Fixes #2296
Changes
The default aggregation type was not handled properly for Observable Counter/UpDownCounter, and the issue was surfaced/evident out with non-zero initial measurement value. Have fixed the issue. Also we were missing the test for Observable UpDownCounter. Have added the test to catch this error.
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes