fix(sdk-node): support headers_list for declarative exporters - #6997
Conversation
Parse and merge declarative headers_list values for OTLP HTTP and gRPC exporters across logs, metrics, and traces. Co-authored-by: Liang Hu <lh3057@columbia.edu> Signed-off-by: Jackson Weber <47067795+JacksonWeber@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6997 +/- ##
==========================================
- Coverage 95.02% 95.02% -0.01%
==========================================
Files 409 409
Lines 14301 14298 -3
Branches 3277 3277
==========================================
- Hits 13590 13587 -3
Misses 711 711
🚀 New features to boost your workflow:
|
Pull request dashboard statusMerged · refreshed 2026-08-12 21:33 UTC Status above doesn't look right?
|
trentm
left a comment
There was a problem hiding this comment.
See a nit below.
Otherwise, LGTM.
| @@ -495,13 +496,14 @@ export function getBatchLogRecordProcessorFromEnv( | |||
| } | |||
|
|
|||
| export function getHeadersFromConfiguration( | |||
There was a problem hiding this comment.
nit: @JacksonWeber Would you be willing to refactor this function into a mergeHeadersConfig() utility in the configuration package -- alongside the existing mergeResourceAttributesConfig and mergePropagatorCompositeConfig. The idea is that the format of these fields is defined by the declarative config schema that "lives" with the configuration package.
There was a problem hiding this comment.
Makes sense. Moved this to mergeHeadersConfig() in the configuration package.
| ); | ||
| }); | ||
|
|
||
| it('parses headers_list and lets headers take precedence', function () { |
There was a problem hiding this comment.
... then this test could move to the configuration package.
| @@ -510,16 +512,16 @@ export function getHeadersFromConfiguration( | |||
| } | |||
|
|
|||
| export function getGrpcMetadataFromHeaders( | |||
There was a problem hiding this comment.
nit: This could potentially move into create-from-config.ts.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
b2ffd97
Which problem is this PR solving?
Declarative OTLP exporter configuration supports
headers_list, butstartNodeSDK()ignored it when creating log, metric, and trace exporters. This could omit authentication or routing headers and emitted an unhandled-property warning for valid configuration.Fixes #6953
Short description of the changes
headers_listwith the existingparseKeyPairsIntoRecordbehavior, including percent decoding.headersoverheaders_list, matching the configuration schema's precedence rules.headers_listas handled for every current OTLP exporter creation path.This incorporates and extends the log-exporter work from #6955 by @LarryHu0217 to cover all exporter paths currently present on
main.Type of change
How Has This Been Tested?
From
experimental/packages/opentelemetry-sdk-node:npm run compilenpm test -- --grep "headers_list exporter wiring|getHeadersFromConfiguration|getGrpcMetadataFromHeaders"npm run lint -- --quietThe tests verify all nine exporter variants, structured-header precedence, percent decoding, gRPC metadata conversion, and absence of unhandled-config warnings.
Checklist:
AI disclosure: GitHub Copilot was used to assist with implementation and test development; the resulting changes were reviewed before submission.