Provides automatic instrumentation tools for OpenTelemetry in Python, enabling seamless tracing and monitoring of Python applications. Current version: 0.61b0. Release cadence: Regular updates with new features and support for additional Python versions.
pip install opentelemetry-instrumentationVerified import paths — ran on the pinned version, not inferred.
Quickstart guide to instrumenting ASGI and WSGI applications using OpenTelemetry.
Update import statements to reflect the new module structure.
Manually instrument unsupported libraries by importing the appropriate instrumentor classes and calling their 'instrument()' methods.
Install the necessary OpenTelemetry instrumentation packages using `pip install opentelemetry-instrumentation` and any specific instrumentation packages for your frameworks (e.g., `pip install opentelemetry-instrumentation-flask`). Always ensure your application is running in the correct Python environment where these packages are installed.
Upgrade all related OpenTelemetry packages to compatible versions. The most reliable fix is often to update `opentelemetry-api`, `opentelemetry-sdk`, and all `opentelemetry-instrumentation-*` packages to their latest stable releases using `pip install --upgrade opentelemetry-api opentelemetry-sdk opentelemetry-instrumentation-requests` (and any other relevant instrumentation packages).
Ensure that the OpenTelemetry SDK, including the `TracerProvider` and a `Resource`, is fully configured and set as the global tracer provider *before* any instrumentors are initialized or any instrumented application code begins execution. If using programmatic instrumentation, place SDK initialization at the very top of your application's entry point.
Verify that the OpenTelemetry SDK is initialized before any instrumented code runs. Add a `ConsoleExporter` to your pipeline for debugging purposes to confirm data generation locally. Check all relevant environment variables, such as `OTEL_EXPORTER_OTLP_ENDPOINT` and `OTEL_TRACES_EXPORTER`, for correct values. Ensure the OpenTelemetry Collector is running and network accessible at the configured endpoint.