Skip to main content

Overview

respan-tracing auto-instruments supported libraries to capture LLM calls, vector DB queries, and framework operations as spans — no code changes required. When a supported library is installed, its calls are automatically traced.

Configure

from respan_tracing import RespanTelemetry, Instruments

Enable all (default)

telemetry = RespanTelemetry(api_key="your-api-key")
# All installed libraries are auto-instrumented

Enable specific instruments only

telemetry = RespanTelemetry(
    api_key="your-api-key",
    instruments={Instruments.OPENAI, Instruments.ANTHROPIC},
)

Block specific instruments

telemetry = RespanTelemetry(
    api_key="your-api-key",
    block_instruments={Instruments.REQUESTS, Instruments.URLLIB3},
)

Disable all auto-instrumentation

telemetry = RespanTelemetry(
    api_key="your-api-key",
    instruments=set(),
)

Available instruments

AI/ML providers

InstrumentLibrary
Instruments.OPENAIopenai
Instruments.ANTHROPICanthropic
Instruments.COHEREcohere
Instruments.MISTRALmistralai
Instruments.OLLAMAollama
Instruments.GROQgroq
Instruments.TOGETHERtogether
Instruments.REPLICATEreplicate
Instruments.TRANSFORMERStransformers

Cloud AI services

InstrumentLibrary
Instruments.BEDROCKboto3 (Bedrock)
Instruments.SAGEMAKERboto3 (SageMaker)
Instruments.VERTEXAIgoogle-cloud-aiplatform
Instruments.GOOGLE_GENERATIVEAIgoogle-generativeai
Instruments.WATSONXibm-watsonx-ai
Instruments.ALEPHALPHAaleph-alpha-client

Vector databases

InstrumentLibrary
Instruments.PINECONEpinecone
Instruments.QDRANTqdrant-client
Instruments.CHROMAchromadb
Instruments.MILVUSpymilvus
Instruments.WEAVIATEweaviate-client
Instruments.LANCEDBlancedb
Instruments.MARQOmarqo

Frameworks

InstrumentLibrary
Instruments.LANGCHAINlangchain
Instruments.LLAMA_INDEXllama-index
Instruments.HAYSTACKhaystack
Instruments.CREWcrewai
Instruments.MCPmcp

Infrastructure

InstrumentLibrary
Instruments.REDISredis
Instruments.REQUESTSrequests
Instruments.URLLIB3urllib3
Instruments.PYMYSQLpymysql
Instruments.THREADINGthreading (stdlib)
THREADING is always enabled by default for proper context propagation across threads. It can be explicitly blocked with block_instruments.

Environment variables

VariableDescriptionDefault
RESPAN_API_KEYRespan API key
RESPAN_BASE_URLAPI base URLhttps://api.respan.ai/api
RESPAN_LOG_LEVELSDK log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)INFO
RESPAN_BATCHING_ENABLEDEnable batch span processing (true / false)true

Troubleshooting

If you see warnings like Failed to initialize Requests instrumentation, install the optional OpenTelemetry instrumentations:
pip install opentelemetry-instrumentation-requests opentelemetry-instrumentation-urllib3
This is optional — tracing works without them. Only needed if your app uses requests or urllib3 and you want those calls traced.