Skip to content
← Back to release · 2.1.265
Improvements / v2.1.265

Export OpenTelemetry directly to named collectors

CHANGELOG · original

Changed Claude apps gateway sessions to export OpenTelemetry directly to a collector the gateway's managed settings name in OTEL_EXPORTER_OTLP_ENDPOINT, instead of through the gateway's relay; sessions without a named collector still use the relay
Open official changelog ↗

Documentation

Documentation excerpt

Export directly to your collector

To have sessions signed in through /login send telemetry straight to your collector instead of through the relay, set OTEL_EXPORTER_OTLP_ENDPOINT to the collector's https:// base URL in the env block of a managed policy. Claude Code appends /v1/metrics, /v1/logs, or /v1/traces to the URL you set, such as https://otel-collector.example.com:4318, and exports each signal there over OTLP/HTTP. Requires Claude Code v2.1.265 or later on each developer's machine. Earlier clients export through the relay.

To authenticate to the collector, set OTEL_EXPORTER_OTLP_HEADERS in the same env block. Sessions never send the developer's gateway session token to a collector named this way.

When you add or change this endpoint in a policy, Claude Code asks each developer to approve it in the security approval dialog before applying it in an interactive session.

Claude Code checks the endpoint before it exports a signal directly, and keeps that signal on the relay when a check fails. The checks include:

  • The endpoint comes from the gateway itself. If you set the same variable in an MDM profile or a local managed-settings.json, exports stay on the relay.
  • The URL uses https://, or http:// to a loopback address
  • The URL resolves to a path ending in /v1/<signal>, with no query or fragment. Claude Code builds that path itself from the generic variable. It uses a per-signal variable such as OTEL_EXPORTER_OTLP_METRICS_ENDPOINT as written, so include the full path there.
  • The URL isn't the gateway's own host. An endpoint addressed to the gateway keeps the relay path and its session token.
  • Neither you nor the developer has configured otelHeadersHelper in any settings source. With a helper configured, every signal stays on the relay.

The endpoint you name changes only where exports go. You still choose which signals export at all with the OTEL_*_EXPORTER selectors.

The endpoint alone doesn't turn export on, so also set the variables that do, unless the gateway already pushes them:

  • If the gateway already pushes the telemetry variables, they cover enablement, selectors, and protocol, and your explicit endpoint overrides the pushed <public_url> value. Set an OTEL_*_EXPORTER selector to otlp yourself only for a signal that no forward_to destination enables.
  • If it doesn't, also set CLAUDE_CODE_ENABLE_TELEMETRY=1, the OTEL_*_EXPORTER selectors, and OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf.

When the developer signs out, or signs in to a different gateway, exports to the collector stop and Claude Code drops each remaining batch rather than sending it.

Documentation snapshot · 2026-09-23

Change details