[SDK] MeterProvider: do not warn in destructor after explicit Shutdown#4085
Open
jaehyeong-cho wants to merge 5 commits into
Open
[SDK] MeterProvider: do not warn in destructor after explicit Shutdown#4085jaehyeong-cho wants to merge 5 commits into
jaehyeong-cho wants to merge 5 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4085 +/- ##
==========================================
- Coverage 82.01% 81.99% -0.01%
==========================================
Files 385 385
Lines 16023 16025 +2
==========================================
- Hits 13139 13138 -1
- Misses 2884 2887 +3
🚀 New features to boost your workflow:
|
ThomsonTan
reviewed
May 15, 2026
| { | ||
| #if OPENTELEMETRY_ABI_VERSION_NO >= 2 | ||
| // Shutdown only once | ||
| if (shutdown_latch_.test_and_set(std::memory_order_acquire)) |
Contributor
There was a problem hiding this comment.
Wondering why is this only fixed for ABI v2? The same issue applies to v1 ABI and the same fix could be applied there too.
Contributor
Author
There was a problem hiding this comment.
Thanks for the review. I thought adding a member variable to a public class is ABI-breaking, so I tried to follow abi-version-policy.md and limited the change to ABI v2 only. If we saw this as a bug, I would try applying it to ABI v1 as well, but I thought it is not that serious.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3511
Changes
Please provide a brief description of the changes here.
It seems natural for
MeterProviderto shut its context down from the destructor, and sinceMeterContextis a shared object, I think it is meaningful to warn about duplicateShutdowncalls.However, I think it may not be a good experience that any user who calls the public
MeterProvider::ShutdownAPI will always receive a warning log afterwards, because this isn't really a misuse case.Therefore, with this PR, I would like to propose limiting
MeterProviderto invoking the context shutdown at most once, so that no warning is emitted in the normal usage path.For significant contributions please make sure you have completed the following items:
CHANGELOG.mdupdated for non-trivial changes