Skip to main content
  1. Sign up — Create an account at platform.respan.ai
  2. Create an API key — Generate one on the API keys page
  3. Add credits or a provider key — Add credits on the Credits page or connect your own provider key on the Integrations page

What is OpenTelemetry?

OpenTelemetry (OTel) is an open-source observability framework for generating, collecting, and exporting telemetry data. If your application is already instrumented with OTel, you can send traces directly to Respan without installing any additional SDK — just configure Respan as your OTLP exporter endpoint. Respan accepts traces via the standard OTLP/HTTP protocol in both JSON and Protobuf formats.

Setup

1

Configure the OTLP exporter

Option A: Environment variables
.env
OTEL_EXPORTER_OTLP_ENDPOINT="https://api.respan.ai/api"
OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer YOUR_RESPAN_API_KEY"
OTEL_EXPORTER_OTLP_PROTOCOL="http/json"
Option B: Direct SDK configuration
# pip install opentelemetry-sdk opentelemetry-exporter-otlp-proto-http
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

exporter = OTLPSpanExporter(
    endpoint="https://api.respan.ai/api/v2/traces",
    headers={"Authorization": "Bearer YOUR_RESPAN_API_KEY"},
)

provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(exporter))
trace.set_tracer_provider(provider)

tracer = trace.get_tracer(__name__)

with tracer.start_as_current_span("my-operation") as span:
    span.set_attribute("gen_ai.request.model", "gpt-4")
    # Your application logic here
    pass
2

Run your application

Start your application as usual. Any OTel-instrumented code will now export traces to Respan automatically.

Configuration

When using environment variables, set:
VariableDescription
OTEL_EXPORTER_OTLP_ENDPOINThttps://api.respan.ai/api
OTEL_EXPORTER_OTLP_HEADERSAuthorization=Bearer YOUR_RESPAN_API_KEY
OTEL_EXPORTER_OTLP_PROTOCOLhttp/json (or http/protobuf)

Attributes

Respan automatically extracts Gen AI semantic conventions and maps them to queryable fields:
AttributeDescription
gen_ai.request.modelRequested model name
gen_ai.usage.prompt_tokensInput token count
gen_ai.usage.completion_tokensOutput token count
gen_ai.prompt.{N}.role / .contentInput messages
gen_ai.completion.{N}.role / .contentOutput messages
Respan-specific attributes for user tracking and grouping:
AttributeDescription
respan.customer.identifierCustomer/user identifier
respan.thread.idThread/conversation identifier
respan.trace_group.idLink related traces
respan.metadataJSON object merged into span metadata
All other attributes are preserved in the span’s metadata and are queryable in the Respan UI. For the full list, see the OTLP ingest API reference.

Observability

Once configured, your traces will appear on the Traces page in Respan.
Agent tracing visualization
Any framework or library with OTel support works out of the box, including:
  • Python: Django, Flask, FastAPI, LangChain, LlamaIndex
  • JS/TS: Express, Next.js, NestJS
  • Go, Java, .NET: All standard OTel SDKs
For Respan’s native tracing SDK with built-in @workflow and @task decorators, see Respan.