Registry / observability / opentelemetry-instrumentation-requests

opentelemetry-instrumentation-requests

JSON →
library0.65b0pypypi✓ verified 25d ago

Provides tracing capabilities for HTTP requests made using the 'requests' library. Current version: 0.61b0. Release cadence: beta releases with incremental improvements.

pip install opentelemetry-instrumentation-requests
INSTALL
IMPORT
SIG · OPENTELEMETRY-INST
O
opentelemetry-instrumentation-requests
observabilitypythonv0.65b0
Install
3.0s avg
Import
Disk
21MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.65b0 · 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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 22.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.0s · import 0.000s · 23MB
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RequestsInstrumentor
from opentelemetry.instrumentation.requests import RequestsInstrumentor
from opentelemetry.instrumentation.requests import RequestsInstrumentor

This script sets up OpenTelemetry tracing, instruments the 'requests' library, and makes an HTTP GET request to 'https://api.example.com'.

import os from opentelemetry.instrumentation.requests import RequestsInstrumentor from opentelemetry import trace from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter from opentelemetry.sdk.resources import Resource, SERVICE_NAME # Set up the OpenTelemetry SDK resource = Resource.create({SERVICE_NAME: 'my-service'}) provider = TracerProvider(resource=resource) provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter())) provider.register() # Instrument the 'requests' library RequestsInstrumentor().instrument() # Make an HTTP request import requests response = requests.get('https://api.example.com') print(response.status_code)
Debug
Known issues
breakingInstrumenting after importing 'requests' may result in incomplete tracing due to module caching.
fix
Ensure 'RequestsInstrumentor().instrument()' is called before importing 'requests'.
affects: all
gotchaSetting 'OTEL_PYTHON_REQUESTS_EXCLUDED_URLS' to exclude certain URLs may not work if the environment variable is not set correctly.
fix
Verify the environment variable is set with the correct regex patterns to exclude desired URLs.
affects: all
breakingThe 'requests' package is a direct dependency of opentelemetry-instrumentation-requests and must be installed.
fix
Install the 'requests' package using pip: 'pip install requests'.
affects: all
breakingThe 'requests' library is a required dependency for 'opentelemetry-instrumentation-requests' and must be installed. The absence of 'requests' will cause a `ModuleNotFoundError`.
fix
Install the 'requests' library using `pip install requests`.
affects: all
Upgrade
Version history
0.65b0latest on PyPI · released Jul 16, 2026
Audit
Dependencies
requestsrequiredRequired for HTTP request instrumentation
Agent activity
53 hits · last 30 days
node
46
Anthropic
1
OpenAI (training)
1
CCBot/2.0 (https://commoncrawl.o
1
Resources
opentelemetry-instrumentation-requests — pip install opentelemetry-instrumentation-requests · libregistry