Problem
I'm trying to export t3code traces to telemetry.dev. Its OTLP endpoint requires auth on every request:
export T3CODE_OTLP_TRACES_URL=https://ingest.telemetry.dev/v1/traces
export T3CODE_OTLP_METRICS_URL=https://ingest.telemetry.dev/v1/metrics
# ...but there is no way to send the required header:
# Authorization: Bearer td_live_...
The exporters can only talk to unauthenticated endpoints. apps/server/src/observability/Layers/Observability.ts calls OtlpTracer.make and OtlpMetrics.layer with just url, exportInterval, and resource. Both APIs accept a headers option, but nothing in apps/server/src/cli/config.ts exposes it, and Effect's OTEL_EXPORTER_OTLP_HEADERS env support only applies to layerFromConfig, which isn't used here.
This isn't specific to telemetry.dev — Honeycomb, Grafana Cloud, and Dash0 all authenticate with a header too. The local Grafana LGTM flow in the docs works because it skips auth entirely. For any hosted backend, the only workaround today is running a local OTel Collector whose sole job is injecting the header:
t3code ──OTLP──▶ collector (adds Authorization) ──OTLP──▶ hosted backend
That's a lot of infrastructure for one HTTP header.
Proposal
Add a T3CODE_OTLP_HEADERS env var using the OTEL_EXPORTER_OTLP_HEADERS wire format (comma-separated key=value pairs):
export T3CODE_OTLP_HEADERS="Authorization=Bearer td_live_..."
- Parse it in
EnvServerConfig (apps/server/src/cli/config.ts), consistent with the existing T3CODE_OTLP_* vars
- Thread it through
ServerConfig and spread headers into both the OtlpTracer.make and OtlpMetrics.layer calls
- Document it in
docs/operations/observability.md next to the other OTLP vars
Notes
- No behavior change when the var is unset; the local LGTM/Tempo flow is unaffected.
Happy to send a PR for this if the approach sounds right.
Problem
I'm trying to export t3code traces to telemetry.dev. Its OTLP endpoint requires auth on every request:
The exporters can only talk to unauthenticated endpoints.
apps/server/src/observability/Layers/Observability.tscallsOtlpTracer.makeandOtlpMetrics.layerwith justurl,exportInterval, andresource. Both APIs accept aheadersoption, but nothing inapps/server/src/cli/config.tsexposes it, and Effect'sOTEL_EXPORTER_OTLP_HEADERSenv support only applies tolayerFromConfig, which isn't used here.This isn't specific to telemetry.dev — Honeycomb, Grafana Cloud, and Dash0 all authenticate with a header too. The local Grafana LGTM flow in the docs works because it skips auth entirely. For any hosted backend, the only workaround today is running a local OTel Collector whose sole job is injecting the header:
That's a lot of infrastructure for one HTTP header.
Proposal
Add a
T3CODE_OTLP_HEADERSenv var using theOTEL_EXPORTER_OTLP_HEADERSwire format (comma-separatedkey=valuepairs):EnvServerConfig(apps/server/src/cli/config.ts), consistent with the existingT3CODE_OTLP_*varsServerConfigand spreadheadersinto both theOtlpTracer.makeandOtlpMetrics.layercallsdocs/operations/observability.mdnext to the other OTLP varsNotes
Happy to send a PR for this if the approach sounds right.