Skip to main content
Applies to:
  • Plan -
  • Deployment -
Summary Configure tracing and observability for OpenAI Realtime API WebSocket sessions using Braintrust’s OpenTelemetry integration. This approach allows you to log session-based traces, capture event metadata, and maintain full control over event schemas without relying on the Braintrust proxy.

Configuration Steps

Step 1: Configure OpenTelemetry for Braintrust

Set up OpenTelemetry to send traces directly to Braintrust’s OTEL endpoint with proper authentication and project context.

Step 2: Initialize session-based tracing

Create a root span for the entire WebSocket session to track the long-lived connection and session-level metadata.

Step 3: Log individual events as nested spans

Create child spans for specific WebSocket events like RAG retrieval and LLM generation to maintain granular observability.

Step 4: Capture conversation data in root span

Store complete conversation context and metadata in the root span to support custom scorers and analysis tools.

Step 5: Close spans and flush data

Properly end spans when events complete and ensure data is sent to Braintrust.