feat(server): allow custom headers on OTLP export (T3CODE_OTLP_HEADERS) #7035
ephraimduncan
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
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.
All reactions