opentelemetry-python-contrib icon indicating copy to clipboard operation
opentelemetry-python-contrib copied to clipboard

Starlette Instrumentation: Allow to pass excluded_urls in the middleware constructor

Open roma-glushko opened this issue 1 year ago • 0 comments
trafficstars

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:

https://github.com/open-telemetry/opentelemetry-python-contrib/blob/main/instrumentation/opentelemetry-instrumentation-starlette/src/opentelemetry/instrumentation/starlette/init.py#L202-L210

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

roma-glushko avatar Sep 11 '24 11:09 roma-glushko