open-telemetry / open-telemetry/opentelemetry-python-contrib

Add a way to enable specific instrumentations rather than rely on disabling

Open
#1,828 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request
Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
4d 15h
Merged PRs (30d)
16

Description

Is your feature request related to a problem?
We have a monorepo with multiple executables sharing a codebase. This means we have many of the opentelemetry instrumentations installed. However we don't necessarily want all instrumentations on all executables. If sticking with opentelemetry-instrumentation, we would need to add to the OTEL_PYTHON_DISABLED_INSTRUMENTATIONS variable every time someone adds a new instrumentation library. This is tedious and error-prone: we can accidentally end up with an instrumentation enabled on some service that we don't want or need.

Describe the solution you'd like
Rather than have to keep adding to the list of OTEL_PYTHON_DISABLED_INSTRUMENTATIONS when running those executables, ideally we can just make the configuration opt-in, and not depend on the ambiently-available instrumentation libraries never changing unexpectedly.

My imagines solution is to add a OTEL_PYTHON_ENABLED_INSTRUMENTATIONS env var with the following semantics:

  • the new env var lists instrumentations that are considered; if the env var is not set, all installed instrumentations are considered so that this doesn't affect the current experience for anyone not setting it
  • the existing OTEL_PYTHON_DISABLED_INSTRUMENTATIONS prevents the listed instrumentations from being enabled
  • it is an error to have a instrumentation in OTEL_PYTHON_ENABLED_INSTRUMENTATIONS that is not installed

Describe alternatives you've considered
I've already added a OURCOMPANY_ENABLED_INSTRUMENTATIONS env var that we use to do this. Ideally this could be pushed up into the library.

Additional context
Add any other context about the feature request here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the existing OTEL_PYTHON_DISABLED_INSTRUMENTATIONS setting is read and how installed instrumentations are selected. Implement the requested enabled-list, fallback, exclusion, and missing-installation error semantics, then verify the behavior with the project's instrumentation configuration tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.