opentelemetry-python-contrib icon indicating copy to clipboard operation
opentelemetry-python-contrib copied to clipboard

opentelemetry-instrumentation-asgi: emit `error.type` attribute when having exceptions

Open emdneto opened this issue 1 year ago • 3 comments
trafficstars

Describe your environment

instrumentation-asgi: 0.47b0.dev

What happened?

instrumentation-asgi isn't setting error.type during exceptions and we should set it in the new semconv as defined here

Steps to Reproduce

Run any asgi example which raises exception before status code is sent or received using the new semconv opt-in mode

Expected Result

If the request fails with an error before response status code was sent or received, error.type SHOULD be set to exception type (its fully-qualified class name, if applicable) or a component-specific low cardinality error identifier.

Exception present in error.type

Actual Result

No error.type attribute set in spans

Additional context

https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2682

https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#http-server-semantic-conventions

Would you like to implement a fix?

None

emdneto avatar Jul 11 '24 20:07 emdneto

Shall I work this? And one question, can I reference opentelemetry-instrumentation-httpx error.type for asgi? https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/instrumentation/opentelemetry-instrumentation-httpx/src/opentelemetry/instrumentation/httpx/init.py#L369

qiuge615 avatar Jul 17 '24 08:07 qiuge615

Hey @qiuge615, I'm Sorry, I didn't see this before. I opened the PR to include it in the upcoming release. Please feel free to review the PR.

emdneto avatar Jul 17 '24 14:07 emdneto

Thank you for your help.

qiuge615 avatar Jul 18 '24 07:07 qiuge615