Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix SimpleExemplarReservoir for cumulative #5230

Merged
merged 13 commits into from
Jan 18, 2024

Conversation

cijothomas
Copy link
Member

@cijothomas cijothomas commented Jan 17, 2024

Fixes SimplerExemplarReservoir for cumulative temporality to reset internal state during collect. Before this change, newer measurements had no fair chance to make it to the reservoir. This PR resets the "number_of_measurements_seen" with every collect, so new measurements has fair chance to make it to reservoir, subject to the reservoir sampling algorithm.

Spec ref: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/sdk.md#simplefixedsizeexemplarreservoir

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@cijothomas cijothomas requested a review from a team January 17, 2024 22:48
Copy link

codecov bot commented Jan 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6250307) 83.38% compared to head (345325e) 83.12%.
Report is 15 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #5230      +/-   ##
==========================================
- Coverage   83.38%   83.12%   -0.27%     
==========================================
  Files         297      271      -26     
  Lines       12531    11970     -561     
==========================================
- Hits        10449     9950     -499     
+ Misses       2082     2020      -62     
Flag Coverage Δ
unittests ?
unittests-Solution-Experimental 83.09% <100.00%> (?)
unittests-Solution-Stable 83.08% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...tation.AspNetCore/Implementation/HttpInListener.cs 89.72% <100.00%> (+0.14%) ⬆️
...emetry/Metrics/Exemplar/SimpleExemplarReservoir.cs 80.43% <100.00%> (ø)

... and 33 files with indirect coverage changes

@@ -57,9 +57,13 @@ public override Exemplar[] Collect(ReadOnlyTagCollection actualTags, bool reset)
if (reset)
Copy link
Member

Choose a reason for hiding this comment

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

unrelated but kind of related nit: maybe this variable should be named isDelta for readability?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes... The Reservoir itself is not necessarily aware of temporality concept. All it needs to know is if it should reset its internal state or not.. The caller knows temporality and passes reset to this...

Copy link
Member

Choose a reason for hiding this comment

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

Not a blocker for this PR, but just looking at this API shape, is the correct thing to do to expose bool reset?

SDKs are free to decide whether "collect" should also reset internal storage for delta temporal aggregation collection, or use a more optimal implementation.

Curious what other languages have done to solve this.

Copy link
Member Author

Choose a reason for hiding this comment

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

The current APIs need to be revised before exposing them to public (its marked internal), and there are many TODOs to be solved.

@alanwest alanwest merged commit 45cf7c3 into open-telemetry:main Jan 18, 2024
37 checks passed
@cijothomas cijothomas deleted the cijothomas/exemplar-reset branch January 18, 2024 19:07
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants