Skip to content

Commit 380a709

Browse files
cijothomaslalitb
andauthored
MeterProvider modified to not do shutdown if user has already shut down (#2156)
Co-authored-by: Lalit Kumar Bhasin <[email protected]>
1 parent 81a95e3 commit 380a709

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

opentelemetry-sdk/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
- For Delta Temporality, exporters are not invoked unless there were new
1515
measurements since the last collect/export.
1616
[#2153](https://github.com/open-telemetry/opentelemetry-rust/pull/2153)
17+
- `MeterProvider` modified to not invoke shutdown on `Drop`, if user has already
18+
called `shutdown()`.
19+
[#2156](https://github.com/open-telemetry/opentelemetry-rust/pull/2156)
1720

1821
## v0.25.0
1922

opentelemetry-sdk/src/metrics/meter_provider.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,12 @@ impl SdkMeterProviderInner {
130130

131131
impl Drop for SdkMeterProviderInner {
132132
fn drop(&mut self) {
133-
if let Err(err) = self.shutdown() {
134-
global::handle_error(err);
133+
// If user has already shutdown the provider manually by calling
134+
// shutdown(), then we don't need to call shutdown again.
135+
if !self.is_shutdown.load(Ordering::Relaxed) {
136+
if let Err(err) = self.shutdown() {
137+
global::handle_error(err);
138+
}
135139
}
136140
}
137141
}

0 commit comments

Comments
 (0)