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

[SDK] Add exemplar reservoir to async metric storage #2319

Merged

Conversation

ThomsonTan
Copy link
Contributor

Fixes #2318

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
  • Unit tests have been added
  • Changes in public API reviewed

@ThomsonTan ThomsonTan requested a review from a team September 19, 2023 22:44
@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Merging #2319 (8ce2994) into main (0563a71) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2319      +/-   ##
==========================================
+ Coverage   87.45%   87.47%   +0.02%     
==========================================
  Files         199      199              
  Lines        5996     5997       +1     
==========================================
+ Hits         5243     5245       +2     
+ Misses        753      752       -1     
Files Changed Coverage
...telemetry/sdk/metrics/state/async_metric_storage.h ø
sdk/src/metrics/meter.cc 100.00%

Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

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

Ok to merge, to keep the async code on par with sync.

The exemplar reservoir feature is not complete yet, and will likely need changes to reach a stable status

Comment on lines +56 to +59
#ifdef ENABLE_METRICS_EXEMPLAR_PREVIEW
exemplar_reservoir_->OfferMeasurement(measurement.second, {}, {},
std::chrono::system_clock::now());
#endif
Copy link
Member

Choose a reason for hiding this comment

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

This makes the async code at par with the sync metric storage, so approved.

In the long term, I think we will need to refactor the exemplar reservoir interface, to reduce overhead.

This calls:

  • creates dummy objects, for each measurements
  • calls now(), for each measurement
  • invoke a virtual function
  • only to land on a noop implementation in common cases

Very wasteful compared to representing a noop reservoir with a nullptr, and testing a pointer.

Ok as long as we have a feature flag.

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.

Thanks for the PR.

@marcalff marcalff merged commit 13f01ca into open-telemetry:main Sep 21, 2023
44 checks passed
@marcalff marcalff changed the title Add exemplar reservoir to async metric storage [SDK] Add exemplar reservoir to async metric storage Oct 11, 2023
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.

Exemplar is missing in async_metric_storage
3 participants