Skip to content

opentelemetry-bootstrap --action=requirements should respect OTEL_PYTHON_DISABLED_INSTRUMENTATIONS #4647

@idan-rahamim-lendbuzz

Description

@idan-rahamim-lendbuzz

What problem do you want to solve?

When building Docker images, we use opentelemetry-bootstrap --action=requirements to generate the list of instrumentor packages to install. However, this command outputs all instrumentors matching installed libraries, even those we explicitly disable at runtime via OTEL_PYTHON_DISABLED_INSTRUMENTATIONS.

This means we install packages we will never use, increasing image size and build time unnecessarily.

Example Dockerfile pattern:

ENV OTEL_PYTHON_DISABLED_INSTRUMENTATIONS="psycopg,system_metrics"

# This still outputs opentelemetry-instrumentation-psycopg and opentelemetry-instrumentation-system-metrics
RUN opentelemetry-bootstrap --action=requirements | pip install -r /dev/stdin

Describe the solution you'd like

opentelemetry-bootstrap should support filtering out disabled instrumentations:

Read OTEL_PYTHON_DISABLED_INSTRUMENTATIONS env var — if set, exclude matching instrumentors from the output. This aligns with the existing runtime behavior.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions