Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto-instrumentation should have a way to disable specific instrumentations #1240

Closed
owais opened this issue Oct 14, 2020 · 6 comments
Closed
Assignees
Labels
auto-instrumentation related to auto-instrumentation of the sdk backlog good first issue Good first issue

Comments

@owais
Copy link
Contributor

owais commented Oct 14, 2020

opentelemetry-instrument command automatically instruments all supported packages. Sometimes it is useful to temporarily disable an instrumentation. Right now the only way to do this is to uninstall the instrumentation package you want to disable. This can be inconvenient especially when the instrument command is coupled with bootstrap command.

Consider an application shipped as a docker container where the docker image does something like the following:

# install main application requirements
RUN pip install -r requirements.tx

# install instrumentation packages
RUN opentelemetry-bootstrap -a=install

COMMAND opentelemetry-instrument python main.py

If the user wants to disable a specific instrumentation, they'll have to modify the docker image to add a pip uninstall after the bootstrap command. This can be very inconvenient in the best case and impossible in the worst case.

It'd be far simpler if the user could run the container with OTEL_PYTHON_DISABLED_INSTRUMENTATIONS=psycopg2 to disable a specific instrumentation (psycopg2 in this example) without having to modify the image and rebuild the containers.

This highlights docker as an example but same issue applies to almost all other deployment scenarios.

Another situation this can be very helpful in is when a user is running off the shelf software that happens to be instrumented with OpenTelemetry Python. User might not be able or willing to fork/modify the product just to disable an instrumentation while adding an environment variable would be trivial.

@dmarar
Copy link
Contributor

dmarar commented Nov 24, 2020

I will claim this issue. Thanks!

@dmarar
Copy link
Contributor

dmarar commented Dec 1, 2020

@owais do you we need to give an extra option from command line as well
something on the lines opentelemetry-instrument -i (or --ignore) django, requests .....
if the env flag is not given, -i will add the env variable , just like how we have -e and other options.

@owais
Copy link
Contributor Author

owais commented Dec 3, 2020

@dmarar I think that would be great to have but feel free to add it as a separate issue if you want to keep the initial PR simple.

@dmarar
Copy link
Contributor

dmarar commented Dec 3, 2020

sure @owais . will create a new PR for it.

@github-actions
Copy link

github-actions bot commented Apr 9, 2021

This issue was marked stale due to lack of activity. It will be closed in 30 days.

@owais owais closed this as completed Apr 9, 2021
@owais
Copy link
Contributor Author

owais commented Apr 9, 2021

Fixed in #1461

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-instrumentation related to auto-instrumentation of the sdk backlog good first issue Good first issue
Projects
None yet
Development

No branches or pull requests

3 participants