diff --git a/instrumentation/opentelemetry-instrumentation-httpx/src/opentelemetry/instrumentation/httpx/__init__.py b/instrumentation/opentelemetry-instrumentation-httpx/src/opentelemetry/instrumentation/httpx/__init__.py index 2a82a123f9..d92463fc27 100644 --- a/instrumentation/opentelemetry-instrumentation-httpx/src/opentelemetry/instrumentation/httpx/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-httpx/src/opentelemetry/instrumentation/httpx/__init__.py @@ -678,6 +678,7 @@ def handle_request( span.set_attribute( ERROR_TYPE, type(exception).__qualname__ ) + span.record_exception(exception) metric_attributes[ERROR_TYPE] = type( exception ).__qualname__ @@ -879,6 +880,7 @@ async def handle_async_request( span.set_attribute( ERROR_TYPE, type(exception).__qualname__ ) + span.record_exception(exception) metric_attributes[ERROR_TYPE] = type( exception ).__qualname__ @@ -1116,6 +1118,7 @@ def _handle_request_wrapper( # pylint: disable=too-many-locals span.set_attribute( ERROR_TYPE, type(exception).__qualname__ ) + span.record_exception(exception) metric_attributes[ERROR_TYPE] = type( exception ).__qualname__ @@ -1238,6 +1241,7 @@ async def _handle_async_request_wrapper( # pylint: disable=too-many-locals span.set_attribute( ERROR_TYPE, type(exception).__qualname__ ) + span.record_exception(exception) raise exception.with_traceback(exception.__traceback__) if duration_histogram_old is not None: