Skip to content

Commit 26c5d97

Browse files
kamalmarhubiocelotl
authored andcommitted
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
1 parent 5a6da15 commit 26c5d97

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
([#3776](https://github.com/open-telemetry/opentelemetry-python/pull/3776))
1616
- Fix ValueError message for PeriodicExportingMetricsReader
1717
([#3769](https://github.com/open-telemetry/opentelemetry-python/pull/3769))
18+
- Add max_scale option to Exponential Bucket Histogram Aggregation
19+
([#3323](https://github.com/open-telemetry/opentelemetry-python/pull/3323))
20+
- Use BoundedAttributes instead of raw dict to extract attributes from LogRecord and Support dropped_attributes_count in LogRecord
21+
([#3310](https://github.com/open-telemetry/opentelemetry-python/pull/3310))
22+
- Use `BaseException` instead of `Exception` in `record_exception`
23+
([#3354](https://github.com/open-telemetry/opentelemetry-python/pull/3354))
1824

1925
## Version 1.23.0/0.44b0 (2024-02-23)
2026

opentelemetry-api/src/opentelemetry/trace/span.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def set_status(
169169
@abc.abstractmethod
170170
def record_exception(
171171
self,
172-
exception: Exception,
172+
exception: BaseException,
173173
attributes: types.Attributes = None,
174174
timestamp: typing.Optional[int] = None,
175175
escaped: bool = False,
@@ -563,7 +563,7 @@ def set_status(
563563

564564
def record_exception(
565565
self,
566-
exception: Exception,
566+
exception: BaseException,
567567
attributes: types.Attributes = None,
568568
timestamp: typing.Optional[int] = None,
569569
escaped: bool = False,

opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ def __exit__(
981981

982982
def record_exception(
983983
self,
984-
exception: Exception,
984+
exception: BaseException,
985985
attributes: types.Attributes = None,
986986
timestamp: Optional[int] = None,
987987
escaped: bool = False,

0 commit comments

Comments
 (0)