Skip to content

opentelemetry-bootstrap -a install is unnecessarily slow — recommend piping to pip install in docs #4484

@idan-rahamim-lendbuzz

Description

@idan-rahamim-lendbuzz

What problem do you want to solve?

opentelemetry-bootstrap --action=install is very slow because it calls pip install -U --upgrade-strategy=only-if-needed <package> in a loop — once per discovered instrumentor (source).

For a typical project with ~8 instrumentors, this means:

  • 8 separate subprocess spawns (each ~0.5s Python startup overhead)
  • 8 separate pip loads (~1s each)
  • 8 separate dependency resolution passes with -U flag (checking PyPI for upgrades each time)
  • 8 separate pip check validations implicitly
    In my testing this takes 60–120 seconds in a Docker build.

Faster alternative

opentelemetry-bootstrap --action=requirements | pip install -r /dev/stdin

This is faster because:

  • 1 subprocess instead of 8
  • 1 pip startup instead of 8
  • 1 resolver pass that handles all packages together, instead of 8 independent passes
  • No -U flag — in a fresh environment (e.g., Docker build), there's nothing to upgrade, so the upgrade check is pure overhead
    In my testing this takes 15–25 seconds — a 4–6x speedup.

Relation to existing docs

The troubleshooting docs already recommend a similar pattern for uv:
uv run opentelemetry-bootstrap -a requirements | uv add --requirement -
But there's no equivalent recommendation for pip users. Since pip is still the default package manager for most Python users, it would be helpful to document this pattern as well.

Suggestions

  1. Add a "Bootstrap using pip" section in the troubleshooting docs alongside the existing "Bootstrap using uv" section, recommending:
    opentelemetry-bootstrap --action=requirements | pip install -r /dev/stdin
  2. Consider changing _run_install to batch all packages into a single pip install call instead of looping, which would make --action=install fast by default without requiring users to discover this workaround.

Environment

Python 3.14
opentelemetry-distro (latest)
Docker build context (fresh venv each time, no cache benefit from -U)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions