open-telemetry / open-telemetry/opentelemetry-python-contrib
AsgiSetter should override header values instead of appending
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 1.1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 16
Description
Describe your environment
Using FastAPI 0.79 and relying on the AsgiSetter. The AsgiSetter has a surprising result to always append values instead of overriding previous keys.
Steps to reproduce
Call AsgiSetter().set() multiple times with the same header name.
What is the expected behavior?
The 2nd call with the same header appends to the previous header value.
What is the actual behavior?
The result will be multiple headers with the same name are added instead of a single header with multiple values.
Additional context
Originally added by me (😬 ) at https://github.com/open-telemetry/opentelemetry-python-contrib/pull/817. It's also not 100% clear what the right behavior should be. Need to investigate the ASGI spec and what happens with multiple tuples with the same header name.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with instrumentation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/init.py around lines 219-240 and review the ASGI specification for repeated header names. Reproduce multiple AsgiSetter().set() calls with the same header name, then define the behavior that matches the specification and verify the implementation follows it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100