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

Add MeterContext::ForEachMeter() method to process callbacks on Meter in thread-safe manner #1783

Merged
merged 2 commits into from
Nov 17, 2022

Conversation

lalitb
Copy link
Member

@lalitb lalitb commented Nov 17, 2022

Fixes #1720

Changes

Another approach to fix #1720 (refer #1777 for first approach) by adding MeterContext::ForEachMeter, which invokes callback to process each meter in thread-safe manner. This will ensure that metric collection doesn't crash for existing meters while new meter is being added.

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

Copy link
Contributor

@johanpel johanpel left a comment

Choose a reason for hiding this comment

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

Thanks @lalitb , this looks like a more performant solution 👍

@lalitb
Copy link
Member Author

lalitb commented Nov 17, 2022

CI failing with transient error for now -
E: Failed to fetch https://packages.microsoft.com/ubuntu/20.04/prod/dists/focal/main/binary-arm64/Packages.gz File has unexpected size (28549 != 28637). Mirror sync in progress? [IP: 13.93.[224](https://github.com/open-telemetry/opentelemetry-cpp/actions/runs/3485953430/jobs/5832023148#step:4:225).173 443] Hashes of expected file:

@codecov
Copy link

codecov bot commented Nov 17, 2022

Codecov Report

Merging #1783 (bd54556) into main (d0571d8) will decrease coverage by 0.01%.
The diff coverage is 88.89%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1783      +/-   ##
==========================================
- Coverage   85.79%   85.79%   -0.00%     
==========================================
  Files         171      171              
  Lines        5214     5220       +6     
==========================================
+ Hits         4473     4478       +5     
- Misses        741      742       +1     
Impacted Files Coverage Δ
sdk/src/metrics/meter_context.cc 88.89% <85.72%> (-0.76%) ⬇️
sdk/src/metrics/state/metric_collector.cc 92.31% <100.00%> (+0.31%) ⬆️

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.

LGTM

@lalitb lalitb merged commit 8f778b7 into open-telemetry:main Nov 17, 2022
yxue pushed a commit to yxue/opentelemetry-cpp that referenced this pull request Dec 5, 2022
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.

Segfaults due to corrupted InstrumentationScope pointer when using multiple meters
3 participants