open-telemetry / open-telemetry/opentelemetry-python-contrib
aiohttp-server instrumentation doesn't pass attributes to the sampler
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
python 3.11, opentelemetry-instrumentation-aiohttp-server v0.43b0 (installed from git).
Steps to reproduce
Use aiohttp-server instrumentation with a sampler based on attributes (e.g. based on http.target)
What is the expected behavior?
Sampler can access and sample attributes, like for the fastapi instrumentation
What is the actual behavior?
Attributes are not passed to the sampler
Additional context
Instrumentation creates a span without attributes and then updates it with attributes. Sampling decision is happening at the span creation, so attributes are ignored.
https://github.com/open-telemetry/opentelemetry-python-contrib/blob/8fd2105ceae604cf39a67f1c4dd154753b43fcd1/instrumentation/opentelemetry-instrumentation-aiohttp-server/src/opentelemetry/instrumentation/aiohttp_server/__init__.py#L225
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 in instrumentation/opentelemetry-instrumentation-aiohttp-server/src/opentelemetry/instrumentation/aiohttp_server/init.py around line 225, then compare the corresponding FastAPI instrumentation behavior. Reproduce the case with a sampler based on http.target and verify that the sampler can access the instrumentation attributes before sampling. Done means aiohttp-server sampling decisions can use those attributes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100