Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dd56e7f

Browse files
authored
Continue processing async instruments if callback fails (open-telemetry#2614)
1 parent bfeb4b8 commit dd56e7f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.11.0-0.30b0...HEAD)
99

10+
- Fix unhandled callback exceptions on async instruments
11+
([#2614](https://github.com/open-telemetry/opentelemetry-python/pull/2614))
1012
- Rename `DefaultCounter`, `DefaultHistogram`, `DefaultObservableCounter`,
1113
`DefaultObservableGauge`, `DefaultObservableUpDownCounter`, `DefaultUpDownCounter`
1214
instruments to `NoOpCounter`, `NoOpHistogram`, `NoOpObservableCounter`,

opentelemetry-sdk/src/opentelemetry/sdk/_metrics/instrument.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ def callback(self) -> Iterable[Measurement]:
9797
)
9898
except StopIteration:
9999
pass
100+
except Exception: # pylint: disable=broad-except
101+
_logger.exception(
102+
"Callback failed for instrument %s.", self.name
103+
)
100104

101105

102106
class Counter(_Synchronous, APICounter):

0 commit comments

Comments
 (0)