feat(otel): support OTEL_EXPORTER_OTLP_HEADERS for authenticated export - #76
Merged
Conversation
The exporter could only reach an unauthenticated OTLP endpoint — there was no way to send an auth token, so a backend that requires one (Honeycomb's x-honeycomb-team, a Bearer token, Grafana Cloud) couldn't receive spans. The OTel example even documented Honeycomb "via the std OTEL env header," which didn't actually work. Read the standard OTEL_EXPORTER_OTLP_HEADERS (and the traces-specific OTEL_EXPORTER_OTLP_TRACES_HEADERS, which takes precedence) as a comma-separated key=value list and attach them to every export over grpc and http. Values carry secrets, so they're never logged. Tested the parse (whitespace, value-with-=, malformed pairs, precedence) and asserted the header actually reaches the endpoint on the wire.
prashar32
force-pushed
the
feat/otel-export-headers
branch
from
June 6, 2026 19:45
b95f068 to
2de29be
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Authenticated OTLP export
The OTel exporter could only talk to an unauthenticated endpoint — there was no way to send an auth token. So any backend that requires one couldn't receive spans, and the example's Honeycomb row (
x-honeycomb-teamheader "via std OTEL env") was actually a broken promise.This reads the standard
OTEL_EXPORTER_OTLP_HEADERS(and the traces-specificOTEL_EXPORTER_OTLP_TRACES_HEADERS, which wins if both are set) — a comma-separated list ofkey=valuepairs — and attaches them to every span export over both gRPC and HTTP:Header values carry secrets, so they're never logged (the startup line logs only endpoint + protocol).
Verified
=, malformed pairs skipped,TRACES_HEADERSprecedence overHEADERS.Authorizationheader arrives.go test ./...green.Unblocks authenticated backends like Honeycomb and Grafana Cloud.