/docs/integrations/otel-exporter

OpenTelemetry

obsrv exports traces in OTLP format so you can pipe them through your existing OpenTelemetry collector — and ingests OTLP for teams already using OTel SDKs.

Export traces to OTLP

Configure an OTLP exporter target on your project. obsrv will ship each committed trace as a translated OTLP ResourceSpans payload to your collector.

{
  "otel_export": {
    "endpoint": "https://otel.example.com/v1/traces",
    "headers": { "Authorization": "Bearer …" },
    "service_name": "support-agent"
  }
}

Ingest OTLP into obsrv

obsrv accepts OTLP/HTTP at /v1/otel/traces. Send your OpenTelemetry SDK exporters there with the project API key as ax-api-key header.

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

provider = TracerProvider()
exporter = OTLPSpanExporter(
    endpoint="https://api.obsrv.tech/v1/otel/traces",
    headers={"x-api-key": os.environ["THETA_API_KEY"]},
)
provider.add_span_processor(BatchSpanProcessor(exporter))
trace.set_tracer_provider(provider)

Translation rules

  • OTel spans become obsrv steps; their parent_span_id becomes parent_step_id.
  • Resource attributes become trace metadata.
  • Spans tagged with gen_ai.* attributes (model, tokens) are typed as llm.
  • Status codes map to step status.