OpenTelemetry requests Instrumentation

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

Usage

import requests
import opentelemetry.instrumentation.requests

# You can optionally pass a custom TracerProvider to
# RequestsInstrumentor.instrument()
opentelemetry.instrumentation.requests.RequestsInstrumentor().instrument()
response = requests.get(url="https://www.example.org/")

API

opentelemetry.instrumentation.requests.get_default_span_name(method)[source]

Default implementation for name_callback, returns HTTP {method_name}.

class opentelemetry.instrumentation.requests.RequestsInstrumentor[source]

Bases: opentelemetry.instrumentation.instrumentor.BaseInstrumentor

An instrumentor for requests See BaseInstrumentor

static uninstrument_session(session)[source]

Disables instrumentation on the session object.