Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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
  • Loading branch information
kamalmarhubi authored and ocelotl committed Mar 20, 2024
commit 0bf9a8612ad980af857dacc6803fcf3a8ec8e3ad
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ 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))
- 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
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