diff --git a/CHANGELOG.md b/CHANGELOG.md index ecba0eb2396..00afde11a11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.11.0-0.30b0...HEAD) +- Fix unhandled callback exceptions on async instruments + ([#2614](https://github.com/open-telemetry/opentelemetry-python/pull/2614)) - Rename `DefaultCounter`, `DefaultHistogram`, `DefaultObservableCounter`, `DefaultObservableGauge`, `DefaultObservableUpDownCounter`, `DefaultUpDownCounter` instruments to `NoOpCounter`, `NoOpHistogram`, `NoOpObservableCounter`, diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/instrument.py b/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/instrument.py index c6e6e4c273b..260a9a77670 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/instrument.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/instrument.py @@ -97,6 +97,10 @@ def callback(self) -> Iterable[Measurement]: ) except StopIteration: pass + except Exception: # pylint: disable=broad-except + _logger.exception( + "Callback failed for instrument %s.", self.name + ) class Counter(_Synchronous, APICounter):