Skip to content

Commit

Permalink
MeterProvider modified to not do shutdown if user has already shut do…
Browse files Browse the repository at this point in the history
…wn (#2156)

Co-authored-by: Lalit Kumar Bhasin <[email protected]>
  • Loading branch information
cijothomas and lalitb authored Sep 30, 2024
1 parent 81a95e3 commit 380a709
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions opentelemetry-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
- For Delta Temporality, exporters are not invoked unless there were new
measurements since the last collect/export.
[#2153](https://github.com/open-telemetry/opentelemetry-rust/pull/2153)
- `MeterProvider` modified to not invoke shutdown on `Drop`, if user has already
called `shutdown()`.
[#2156](https://github.com/open-telemetry/opentelemetry-rust/pull/2156)

## v0.25.0

Expand Down
8 changes: 6 additions & 2 deletions opentelemetry-sdk/src/metrics/meter_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,12 @@ impl SdkMeterProviderInner {

impl Drop for SdkMeterProviderInner {
fn drop(&mut self) {
if let Err(err) = self.shutdown() {
global::handle_error(err);
// 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);
}
}
}
}
Expand Down

0 comments on commit 380a709

Please sign in to comment.