From 26c5d975200e3d1629f6fdaa8a3ae28486a730a2 Mon Sep 17 00:00:00 2001 From: Kamal Al Marhubi Date: Wed, 7 Jun 2023 23:41:55 -0400 Subject: [PATCH] record_exception: Accept BaseException This makes it possible to call on the exception returned by [sys.exc_info], which is a BaseException. For ecosystem prior art, the [equivalent in Java] accepts a Throwable rather than Exception. [sys.exc_info]: https://docs.python.org/3/library/sys.html#sys.exc_info [equivalent in Java]: https://github.com/open-telemetry/opentelemetry-java/blob/7b8608591e1737ea0727d2373ddd813bc18cdaaa/api/all/src/main/java/io/opentelemetry/api/trace/Span.java#L344-L351 --- CHANGELOG.md | 6 ++++++ opentelemetry-api/src/opentelemetry/trace/span.py | 4 ++-- opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca3d0687bf1..468c0844f05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#3776](https://github.com/open-telemetry/opentelemetry-python/pull/3776)) - Fix ValueError message for PeriodicExportingMetricsReader ([#3769](https://github.com/open-telemetry/opentelemetry-python/pull/3769)) +- Add max_scale option to Exponential Bucket Histogram Aggregation + ([#3323](https://github.com/open-telemetry/opentelemetry-python/pull/3323)) +- Use BoundedAttributes instead of raw dict to extract attributes from LogRecord and Support dropped_attributes_count in LogRecord + ([#3310](https://github.com/open-telemetry/opentelemetry-python/pull/3310)) +- Use `BaseException` instead of `Exception` in `record_exception` + ([#3354](https://github.com/open-telemetry/opentelemetry-python/pull/3354)) ## Version 1.23.0/0.44b0 (2024-02-23) 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 7c0a194c82a..4f25f73b904 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py @@ -981,7 +981,7 @@ def __exit__( def record_exception( self, - exception: Exception, + exception: BaseException, attributes: types.Attributes = None, timestamp: Optional[int] = None, escaped: bool = False,