The TensorZero Gateway can export traces to an external OpenTelemetry-compatible observability system. Exporting traces via OpenTelemetry allows you to monitor the TensorZero Gateway in external observability platforms such as Jaeger, Datadog, or Grafana. This integration enables you to correlate gateway activity with the rest of your infrastructure, providing deeper insights and unified monitoring across your systems.
Exporting traces via OpenTelemetry does not replace the core observability features built into TensorZero.Many key TensorZero features (including optimization) require richer observability data that TensorZero collects and stores in your ClickHouse database. Traces exported through OpenTelemetry are for external observability only and are not sufficient for these built-in TensorZero capabilities.
You can find a complete runnable example exporting traces to Jaeger on GitHub.

Setup

  1. Enable export.otlp.traces.enabled in the [gateway] section of the tensorzero.toml configuration file:
[gateway]
# ...
export.otlp.traces.enabled = true
# ...
  1. Set the OTEL_EXPORTER_OTLP_TRACES_ENDPOINT environment variable in the gateway container to the endpoint of your OpenTelemetry service.

Traces

Once configured, the TensorZero Gateway will begin sending traces to your OpenTelemetry-compatible service. Traces are generated for each HTTP request handled by the gateway (excluding auxiliary endpoints). For inference requests, these traces additionally contain spans that represent the processing of functions, variants, models, and model providers. Screenshot of TensorZero Gateway traces in Jaeger
The TensorZero Gateway also provides a Prometheus-compatible metrics endpoint at /metrics. This endpoint includes metrics about the gateway itself rather than the data processed by the gateway. See Auxiliary Endpoints for more details.