Skip to content

Commit

Permalink
record_exception: Accept BaseException
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kamalmarhubi authored and ocelotl committed Mar 20, 2024
1 parent 5a6da15 commit 26c5d97
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-api/src/opentelemetry/trace/span.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 26c5d97

Please sign in to comment.