From c2fc94563470215cd4ee51096d65bad72aa8b266 Mon Sep 17 00:00:00 2001 From: Kamal Marhubi Date: Wed, 27 Mar 2024 19:54:51 -0400 Subject: [PATCH] record_exception: Accept BaseException (#3354) --- CHANGELOG.md | 2 ++ opentelemetry-api/src/opentelemetry/trace/span.py | 4 ++-- opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d4a7add3c6..aab968eddb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#3648](https://github.com/open-telemetry/opentelemetry-python/pull/3648)) - Fix ValueError message for PeriodicExportingMetricsReader ([#3769](https://github.com/open-telemetry/opentelemetry-python/pull/3769)) +- Use `BaseException` instead of `Exception` in `record_exception` + ([#3354](https://github.com/open-telemetry/opentelemetry-python/pull/3354)) - Make span.record_exception more robust ([#3778](https://github.com/open-telemetry/opentelemetry-python/pull/3778)) - Fix license field in pyproject.toml files diff --git a/opentelemetry-api/src/opentelemetry/trace/span.py b/opentelemetry-api/src/opentelemetry/trace/span.py index 8201fdb251e..5d46ffcb4a9 100644 --- a/opentelemetry-api/src/opentelemetry/trace/span.py +++ b/opentelemetry-api/src/opentelemetry/trace/span.py @@ -169,7 +169,7 @@ def set_status( @abc.abstractmethod def record_exception( self, - exception: Exception, + exception: BaseException, attributes: types.Attributes = None, timestamp: typing.Optional[int] = None, escaped: bool = False, @@ -563,7 +563,7 @@ def set_status( def record_exception( self, - exception: Exception, + exception: BaseException, attributes: types.Attributes = None, timestamp: typing.Optional[int] = None, escaped: bool = False, diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py index ff999b9ba89..0110a5c0e05 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py @@ -983,7 +983,7 @@ def __exit__( def record_exception( self, - exception: Exception, + exception: BaseException, attributes: types.Attributes = None, timestamp: Optional[int] = None, escaped: bool = False,