Registry /
observability / opentelemetry-contrib-instrumentations
Install & Compatibility
Where this runs
tested against v0.63b1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.932s · 58.3MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 8.8s · import 0.843s · 56MB
56MB installed
● package 56MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
RequestsInstrumentor
✓ from opentelemetry.instrumentation.requests import RequestsInstrumentor
✗ from opentelemetry_contrib_instrumentations import RequestsInstrumentor
The `opentelemetry-contrib-instrumentations` package is a convenience for installation. Individual instrumentations must still be imported from their specific `opentelemetry-instrumentation-*` packages, not from the metapackage itself.
configure_opentelemetry
✓ from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor
from opentelemetry.instrumentation.distro import OpenTelemetryDistro
def configure_opentelemetry(service_name: str):
resource = Resource.create({"service.name": service_name})
tracer_provider = TracerProvider(resource=resource)
span_processor = SimpleSpanProcessor(ConsoleSpanExporter())
tracer_provider.add_span_processor(span_processor)
# Set the global tracer provider
from opentelemetry import trace
trace.set_tracer_provider(tracer_provider)
# Instrument all installed contrib instrumentations
distro = OpenTelemetryDistro()
distro.instrument()
# Or, to instrument specific packages:
# from opentelemetry.instrumentation.requests import RequestsInstrumentor
# RequestsInstrumentor().instrument()
✗ from opentelemetry_contrib_instrumentations import configure_instrumentations
There is no single `configure_instrumentations` function in the contrib metapackage. Instrumentation is typically enabled by iterating through `OpenTelemetryDistro().instrument()` or by calling `.instrument()` on individual `Instrumentor` classes after setting up the `TracerProvider`.
This quickstart demonstrates how to set up the OpenTelemetry SDK with a console exporter and then enable automatic tracing for the `requests` library. It initializes a `TracerProvider`, configures a `SimpleSpanProcessor` with a `ConsoleSpanExporter` to print traces to the console, and then uses `RequestsInstrumentor().instrument()` to automatically trace HTTP requests made with the `requests` library. Run the script and observe the trace output in the console. For a more comprehensive automatic instrumentation, you can also use `opentelemetry-distro` which automatically instruments all compatible installed libraries.
import os
import requests
from opentelemetry import trace
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor
from opentelemetry.instrumentation.requests import RequestsInstrumentor
# Configure OpenTelemetry SDK
resource = Resource.create({"service.name": os.environ.get('OTEL_SERVICE_NAME', 'my-python-app')})
tracer_provider = TracerProvider(resource=resource)
span_processor = SimpleSpanProcessor(ConsoleSpanExporter())
tracer_provider.add_span_processor(span_processor)
trace.set_tracer_provider(tracer_provider)
# Instrument the requests library
RequestsInstrumentor().instrument()
# Make an HTTP request that will be traced
def make_request():
print("Making an HTTP request...")
response = requests.get("https://www.example.com")
print(f"Request completed with status: {response.status_code}")
if __name__ == "__main__":
make_request()
# To run this, install:
# pip install opentelemetry-sdk opentelemetry-exporter-console opentelemetry-instrumentation-requests requests
Debug
Known issues
betaThe `opentelemetry-contrib-instrumentations` package, like many OpenTelemetry Python components, is still in 'beta' (indicated by 'b' in version number). This means breaking changes can be introduced between releases without a full major version bump, though efforts are made to minimize these.fixReview changelogs carefully when upgrading, especially for individual instrumentation packages. Pin versions of critical instrumentations.
affects: All versions up to 0.62b0
breakingBreaking changes are often introduced within individual instrumentation packages, not directly by the `opentelemetry-contrib-instrumentations` metapackage. For example, specific instrumentations may drop support for older versions of the libraries they instrument, or rename callback classes.fixAlways check the `CHANGELOG.md` in the `opentelemetry-python-contrib` repository, focusing on the specific instrumentation packages you are using. Pin versions of individual `opentelemetry-instrumentation-*` packages if necessary.
affects: All versions, consult individual instrumentation changelogs
gotchaDependency conflicts can arise between the version requirements of an `opentelemetry-instrumentation-*` package and the version of the actual library you are instrumenting. For example, a Flask instrumentation might require `Werkzeug<3.0.0` while your application installs `Werkzeug==3.0.0`.fixEnsure that the versions of your application's dependencies are compatible with the respective OpenTelemetry instrumentation packages. Check the `setup.cfg` or `pyproject.toml` of the individual instrumentation for its dependency ranges.
affects: All versions
gotchaUsing forking web servers (e.g., Gunicorn with multiple workers) can lead to issues with OpenTelemetry components, particularly the `PeriodicExportingMetricReader`, due to inconsistencies in background threads and locks across child processes.fixConsider running Gunicorn with a single worker (`gunicorn -w 1 app:app`) or use programmatic auto-instrumentation. For metrics, avoid `PrometheusMetricReader` with forking servers; use `PeriodicExportingMetricReader` with one OTLP worker per process to push to Prometheus.
affects: All versions
Upgrade
Version history
0.63b1latest on PyPI · released May 21, 2026
Audit
Dependencies
opentelemetry-apirequiredCore OpenTelemetry API, fundamental for any OTel usage.
opentelemetry-sdkrequiredCore OpenTelemetry SDK, required for processing and exporting telemetry.
opentelemetry-instrumentation-*requiredThis is a metapackage that installs many individual instrumentation packages (e.g., `opentelemetry-instrumentation-requests`).