open-telemetry / open-telemetry/opentelemetry-python-contrib
instrumentation-requests spans don't use templated URL path
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
OS: (e.g, Ubuntu)
Ubuntu
Python version: (e.g., Python 3.9.10)
3.11
Package version: (e.g., 0.46.0)
0.57b0
What happened?
The spans generated by the opentelemetry-instrumentation-requests library do not use templated URLs so we end up with spans with very high cardinality.
According to the OTEL spec https://opentelemetry.io/docs/specs/otel/trace/api/#span the library should not include these URL parameters in the span name but should add them as span attributes instead.
I've seen https://github.com/open-telemetry/opentelemetry-python-contrib/issues/434 which seems to suggest that this is a feature request and that it's only associated with a couple of other libraries. However, from what I can see the library has not implemented a "SHOULD" part of the spec which makes this a bug.
An ideal implementation would allow customisation so that some path variables that don't have high cardinality can be kept in the name.
Steps to Reproduce
- Use the
opentelemetry-instrumentation-requestslibrary for instrumentation - Add a route with path variables to your app like
account/{accountId}
Expected Result
Generated spans have names like GET account/12345
Actual Result
Generated spans should have names like GET account or GET account/{accountId}
Additional context
No response
Would you like to implement a fix?
None
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
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
The issue identifies the opentelemetry-instrumentation-requests library but names no source files or tests. Start by locating its span-name generation and existing instrumentation tests, then reproduce a route such as account/{accountId}. Done should prevent high-cardinality path values from entering span names while preserving the requested customization behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100