open-telemetry / open-telemetry/opentelemetry-python-contrib
Starlette Instrumentation: Allow to pass excluded_urls in the middleware constructor
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 1.1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 16
Description
What problem do you want to solve?
I want exclude health probe endpoints in my framework (e.g. they are at the same URL in all microservices) that are used by a few dozens of microservices.
Describe the solution you'd like
I would like to pass a list of well-known URL to exclude seamlessly for all microservices. That's not really possible without hacks as the middleware constructor doesn't expose a relevant configuration in:
Describe alternatives you've considered
I could use environment variables like OTEL_PYTHON_STARLETTE_EXCLUDED_URLS or OTEL_PYTHON_EXCLUDED_URLS, but it would mean:
- adding that env var to a few dozens of microservice charts
- potentially exposing this unneeded information to chart users (that might be outside of the team or even organization)
So it would be so much better to keep this knowledge as part of the framework.
Additional Context
No response
Would you like to implement a fix?
None
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 at the Starlette middleware constructor in instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/init.py, around lines 202-210, and trace how its configuration reaches request instrumentation. Done means callers can provide excluded URLs there so shared health-probe endpoints are omitted without environment variables.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, observability-sre
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100