opentelemetry.io icon indicating copy to clipboard operation
opentelemetry.io copied to clipboard

Use uv-native approach in python instrumentation docs

Open JulianDroste opened this issue 2 months ago • 3 comments

What needs to be changed?

I would love for the docs to convey the uv-native way of installing packages:

  • replace uv pip install --requirement - with uv add --requirement -
    • would also enable users to put otel stuff into dependency groups more easily
  • replace uv pip install opentelemetry-distro opentelemetry-exporter-otlp with the appropriate uvx / uv tool run tool call
    • I already did some digging (see additional context) but still the uvx approach is missing 4 package dependencies - I just cannot figure out why:
opentelemetry-instrumentation-system-metrics==0.59b0
opentelemetry-instrumentation-tortoiseorm==0.59b0
opentelemetry-instrumentation-jinja2==0.59b0
opentelemetry-instrumentation-click==0.59b0

What is the name + path of the page that needs changed? Bootstrap using uv

Additional context:

When running the following as per the docs I get 14 required dependencies as of today:

$ uv run opentelemetry-bootstrap -a requirements

opentelemetry-instrumentation-asyncio==0.59b0
opentelemetry-instrumentation-dbapi==0.59b0
opentelemetry-instrumentation-logging==0.59b0
opentelemetry-instrumentation-sqlite3==0.59b0
opentelemetry-instrumentation-threading==0.59b0
opentelemetry-instrumentation-urllib==0.59b0
opentelemetry-instrumentation-wsgi==0.59b0
opentelemetry-instrumentation-click==0.59b0
opentelemetry-instrumentation-grpc==0.59b0
opentelemetry-instrumentation-jinja2==0.59b0
opentelemetry-instrumentation-requests==0.59b0
opentelemetry-instrumentation-system-metrics==0.59b0
opentelemetry-instrumentation-tortoiseorm==0.59b0
opentelemetry-instrumentation-urllib3==0.59b0

as compared to the more uv-native way:

uvx --from="opentelemetry-instrumentation" opentelemetry-bootstrap -a requirements | uv add --requirement -

where I due to the output of the pre-pipe part of the command, only obtain 7 packages:

opentelemetry-instrumentation-asyncio==0.59b0
opentelemetry-instrumentation-dbapi==0.59b0
opentelemetry-instrumentation-logging==0.59b0
opentelemetry-instrumentation-sqlite3==0.59b0
opentelemetry-instrumentation-threading==0.59b0
opentelemetry-instrumentation-urllib==0.59b0
opentelemetry-instrumentation-wsgi==0.59b0

Adding --with="opentelemetry-exporter-otlp" and --with="opentelemetry-distro" I gain the following packages

opentelemetry-instrumentation-grpc==0.59b0
opentelemetry-instrumentation-requests==0.59b0
opentelemetry-instrumentation-urllib3==0.59b0

Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

JulianDroste avatar Oct 28 '25 09:10 JulianDroste

@open-telemetry/python-approvers PTAL

svrnm avatar Oct 28 '25 10:10 svrnm

@open-telemetry/python-approvers PTAL!

svrnm avatar Nov 19 '25 11:11 svrnm

@JulianDroste opentelemetry-bootstrap scans the current environment for packages we have instrumentation for, if it doesn't list a package it is because it doesn't find it. uv pip install opentelemetry-distro opentelemetry-exporter-otlp should be uv add opentelemetry-distro opentelemetry-exporter-otlp since these will be requirements of the instrumented application.

Using plain uv instead of uvx should be just fine. Said that feel free to open a PR so we can review it.

xrmx avatar Nov 19 '25 14:11 xrmx