-
Notifications
You must be signed in to change notification settings - Fork 505
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 global::meter_provider_shutdown #1623
Add global::meter_provider_shutdown #1623
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1623 +/- ##
=======================================
+ Coverage 68.2% 69.0% +0.7%
=======================================
Files 139 139
Lines 19801 19849 +48
=======================================
+ Hits 13521 13702 +181
+ Misses 6280 6147 -133 ☔ View full report in Codecov by Sentry. |
can you add a targeted test for this? Similar to #1620 |
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
Good point. Have added the tests now. |
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
Co-authored-by: Zhongyang Wu <zhongyang.wu@outlook.com>
impl Drop for SdkMeterProvider { | ||
fn drop(&mut self) { | ||
if let Err(err) = self.shutdown() { | ||
global::handle_error(err); |
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.
this might cause false alarms.. it is normal for users to call shutdown of their own, and then drop will call it again, causing the global error handler to print a message. It is unactionable for users, and they haven't anything wrong either.... Might need to revisit.
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.
It's even worse because this is bugged because drop
ping just one reference to any metrics provider will shutdown and terminate the underlying data (pipelines), invalidating all copies, especially the registered global metrics provider.
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!
we need follow ups for the below:
- Multi shutdown errors can cause unwanted confusion. (user calling shutdown() themselves, + drop)
- after shutdown and drop, we need to reclaim full memory used for instruments. This might not be possible with current design.
Isn't this a restore of sorts? Should we consider a 0.22.2 patch? |
Good point. Lets discuss in the next community meeting and decide. |
On rethinking, I think we can live without shutdown on the The drop impl to invoke shutdown is still required in sdk. The only drawback is when app owners don't have meter_provider - but that should only occur when using tracing-opentelemetry or others, and can be fixed in those places. The OTLP Exporter in the repo also exposes pipeline builders, which also would require tweaks to account for this. |
I actually prefer
Hmm the app owner should always has control of providers even in |
|
Just to clearify: are we proposing removing support of the global
Yes. App owner should be the one creating providers but the benifit of a global signal provider is app owner doesn't need to manage the lifetime of signal provider until shutdown. Otherwise it can be painful to pass the signal provider along the app due to the ownership model |
yes agree. its covered in #1592 |
I am in agreement. We need to revert adding global_shutdown part of this PR, and follow through and cleanup other signals too. |
Suggestion is to remove the |
I am OK if we want to remove However, for end users, if they set the global signal prvoider using |
Yes, that's a good point. This is an issue as of now too as there is no way to do force_flush after the call to set_<signal>_provider. |
Fixes #1619
Changes
global::shutdown_meter_provider()
which internally sets the global provider toNoopMeterProvider
.Drop
implementation forSdkMeterProvider
, which ensures that the pipeline shutdown is invoked onceSdkMeterProvider
goes out of scope.global::shutdown_meter_provider()
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial, user-facing changes