-
Notifications
You must be signed in to change notification settings - Fork 437
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
Global error handler cleanup - MeterProvider #2237
Changes from 3 commits
008c164
aa85b81
89a1743
603ebca
39c453d
64261b7
c68bbb7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,8 @@ | |
}; | ||
|
||
use opentelemetry::{ | ||
global, | ||
metrics::{Meter, MeterProvider, MetricsError, Result}, | ||
KeyValue, | ||
otel_debug, KeyValue, | ||
}; | ||
|
||
use crate::{instrumentation::Scope, Resource}; | ||
|
@@ -137,13 +136,21 @@ | |
fn drop(&mut self) { | ||
// If user has already shutdown the provider manually by calling | ||
// shutdown(), then we don't need to call shutdown again. | ||
if !self.is_shutdown.load(Ordering::Relaxed) { | ||
if let Err(err) = self.shutdown() { | ||
global::handle_error(err); | ||
} | ||
if self.is_shutdown.load(Ordering::Relaxed) { | ||
otel_debug!( | ||
name: "MeterProvider.AlreadyShutdown", | ||
message = "Meter provider was already shut down; drop will not attempt shutdown again." | ||
); | ||
} else if let Err(err) = self.shutdown() { | ||
otel_debug!( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This one is a better fit for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, deciding between |
||
name: "MeterProvider.ShutdownFailed", | ||
message = "Shutdown attempt failed during drop of MeterProvider.", | ||
reason = format!("{}", err) | ||
); | ||
} | ||
} | ||
} | ||
|
||
impl MeterProvider for SdkMeterProvider { | ||
fn versioned_meter( | ||
&self, | ||
|
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.
nit: change semicolon to comma?