chore(spanner): implement shutdown and Drop handler for Observability meter provider - #6246
chore(spanner): implement shutdown and Drop handler for Observability meter provider#6246olavloite wants to merge 1 commit into
Conversation
… meter provider - Add explicit `Observability::shutdown(&self)` method to shut down the underlying OpenTelemetry `SdkMeterProvider`, flushing pending metric data points and stopping periodic reader background tasks. - Implement `Drop` for `Observability` so telemetry resources are cleanly released when clients are closed or dropped. - Ignore `OTelSdkError::AlreadyShutdown` on repeated calls to `shutdown(&self)` to prevent false-positive warning logs.
There was a problem hiding this comment.
Code Review
This pull request implements graceful shutdown and resource cleanup for the OpenTelemetry SdkMeterProvider in the Spanner observability module. It renames _meter_provider to meter_provider, implements a shutdown method that handles AlreadyShutdown errors, and implements the Drop trait to automatically trigger shutdown when Observability is dropped. Additionally, new unit tests are added to verify the shutdown and drop behaviors. I have no feedback to provide as the changes are well-implemented and include appropriate test coverage.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6246 +/- ##
=======================================
Coverage 96.07% 96.07%
=======================================
Files 273 273
Lines 68742 68766 +24
=======================================
+ Hits 66042 66066 +24
Misses 2700 2700 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Observability::shutdown(&self)method to shut down the underlying OpenTelemetrySdkMeterProvider, flushing pending metric data points and stopping periodic reader background tasks.DropforObservabilityso telemetry resources are cleanly released when clients are closed or dropped.OTelSdkError::AlreadyShutdownon repeated calls toshutdown(&self)to prevent false-positive warning logs.