OpenTelemetry (OTEL) Compliance

AI Gateway is OpenTelemetry (OTEL) compliant, making it easy to integrate with modern observability tools and platforms.

Key Features

  • Standardized Telemetry: Captures and exports traces, metrics, and logs using OpenTelemetry SDKs and conventions.
  • OTLP Export: Sends telemetry via the OpenTelemetry Protocol (OTLP) over HTTP, compatible with popular backends (Grafana, Datadog, Jaeger, etc.).

Example Trace Overview - AI Gateway:

AI Gateway - OpenTelemetry Tracing

Each row on the left represents a request to the endpoint, with the selected trace showing a detailed breakdown of the request and its spans.

Highlighted Span – chatCompletions (LLM):
The highlighted span is of type genai (LLM), capturing the lifecycle of a large language model (LLM) inference request.

LLM Request Data:

  • Model: openai-main/gpt-4o
  • Max tokens: 200
  • Top-p: 1
  • Temperature: 0.1

Prompt and Completion:
The system prompt, user question, and assistant’s response are all visible, providing full transparency into the LLM interaction.

Span Metadata:
Includes span name, service name, trace and span IDs, and OTEL scope.


Compatible Backends

  • OpenTelemetry Collector
  • Jaeger
  • Datadog
  • New Relic
  • Any OTLP-compatible backend

How to Enable

To enable OTEL tracing and log export, configure the following environment variables:

  • ENABLE_OTEL_TRACING: Set to true to enable OTEL tracing.
  • OTEL_EXPORTER_OTLP_ENDPOINT: The OTEL exporter endpoint (e.g., your collector or backend).
  • OTEL_EXPORTER_OTLP_HEADERS: Any required headers for authentication/configuration.
  • OTEL_SERVICE_NAME: The name of your service as recognized by OTEL.

Enable OpenTelemetry Tracing in TrueFoundry’s Tracing Project

Set these environment variables for TrueFoundry integration:

ENABLE_OTEL_TRACING=true
OTEL_SERVICE_NAME=<custom_service_name>
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://<tfy-control-plane-base-url>/api/otel/v1/traces
OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer <TOKEN>,TFY-Tracing-Project=tracing-project:truefoundry/<PROJECT_NAME>/<custom_service_name>"

AI Gateway Spans

The following sections describe the various spans available in the AI Gateway and their attributes.