RespanTelemetry()
Initialize
RespanTelemetry is the main entry point for the SDK. It initializes the OpenTelemetry tracer, configures span processors/exporters, and enables auto-instrumentation for supported libraries.
When api_key is provided (or set via RESPAN_API_KEY env var), the SDK automatically adds a default processor that exports spans to Respan.
Constructor parameters
Environment variables
Constructor parameters take precedence over environment variables.
Examples
Minimal setup with env vars
Full configuration
Suppress noisy instrumentation
Use block_instruments to disable HTTP-level tracing (e.g., requests, urllib3) that can clutter traces when using multiple LLM providers:
Disabled mode
add_processor()
Add a custom span processor with optional filtering. This lets you route spans to multiple destinations (file, console, external services) alongside the default Respan exporter.
Route spans to multiple exporters
Then use processors on decorators to route spans:
flush()
Force flush all pending spans to exporters. Useful before process exit or in serverless environments.