diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py index 0110a5c0e05..5a52a386033 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py @@ -994,9 +994,11 @@ def record_exception( traceback.format_exception( type(exception), value=exception, tb=exception.__traceback__ ) - ) + ) + module = exception.__class__.__module__ if exception.__class__.__module__ != "builtins" else "" + 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),