OpenTelemetry requests Integration

This library allows tracing HTTP requests made by the requests library.


import requests
import opentelemetry.ext.requests

# You can optionally pass a custom TracerProvider to RequestInstrumentor.instrument()
response = requests.get(url="")


Note that calls that do not use the higher-level APIs but use requests.sessions.Session.send (or an alias thereof) directly, are currently not traced. If you find any other way to trigger an untraced HTTP request, please report it via a GitHub issue with [requests: untraced API] in the title.


class opentelemetry.ext.requests.RequestsInstrumentor[source]

Bases: opentelemetry.auto_instrumentation.instrumentor.BaseInstrumentor

An instrumentor for requests See BaseInstrumentor

static uninstrument_session(session)[source]

Disables instrumentation on the session object.