Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add capture the fully qualified type name for raised exceptions in spans #3837

Merged
merged 13 commits into from
Apr 11, 2024
6 changes: 4 additions & 2 deletions opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -994,9 +994,11 @@ def record_exception(
traceback.format_exception(
type(exception), value=exception, tb=exception.__traceback__
)
)
)
emdneto marked this conversation as resolved.
Show resolved Hide resolved
module = exception.__class__.__module__ if exception.__class__.__module__ != "builtins" else ""
emdneto marked this conversation as resolved.
Show resolved Hide resolved
exc_type = f"{module}.{exception.__class__.__qualname__}" if module else exception.__class__.__qualname__
_attributes: MutableMapping[str, types.AttributeValue] = {
"exception.type": exception.__class__.__name__,
"exception.type": exc_type,
"exception.message": str(exception),
"exception.stacktrace": stacktrace,
"exception.escaped": str(escaped),
Expand Down