open-telemetry / open-telemetry/opentelemetry-python-contrib

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

Open
#2,699 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
4d 15h
Merged PRs (30d)
16

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the instrumentation-asgi package's exception-handling path and run an ASGI example that raises before a response status is sent, using the new semantic-convention opt-in mode. Compare the resulting span attributes with the HTTP server semantic conventions; done when the exception type appears as error.type for this failure path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.