Skip to content

fix(sdk-node): support headers_list for declarative exporters - #6997

Merged
JacksonWeber merged 2 commits into
open-telemetry:mainfrom
JacksonWeber:jacksonweber/headers-list-6953
Aug 12, 2026
Merged

fix(sdk-node): support headers_list for declarative exporters#6997
JacksonWeber merged 2 commits into
open-telemetry:mainfrom
JacksonWeber:jacksonweber/headers-list-6953

Conversation

@JacksonWeber

Copy link
Copy Markdown
Contributor

Which problem is this PR solving?

Declarative OTLP exporter configuration supports headers_list, but startNodeSDK() 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

  • Parse headers_list with the existing parseKeyPairsIntoRecord behavior, including percent decoding.
  • Merge structured headers over headers_list, matching the configuration schema's precedence rules.
  • Apply the merged values to HTTP headers and gRPC metadata for log, metric, and trace exporters.
  • Mark headers_list as handled for every current OTLP exporter creation path.
  • Add parameterized coverage for logs, metrics, and traces across HTTP/protobuf, HTTP/JSON, and gRPC.
  • Add an experimental changelog entry.

This incorporates and extends the log-exporter work from #6955 by @LarryHu0217 to cover all exporter paths currently present on main.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

From experimental/packages/opentelemetry-sdk-node:

  • npm run compile
  • npm test -- --grep "headers_list exporter wiring|getHeadersFromConfiguration|getGrpcMetadataFromHeaders"
  • npm run lint -- --quiet

The tests verify all nine exporter variants, structured-header precedence, percent decoding, gRPC metadata conversion, and absence of unhandled-config warnings.

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated via the experimental changelog

AI disclosure: GitHub Copilot was used to assist with implementation and test development; the resulting changes were reviewed before submission.

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>
@JacksonWeber
JacksonWeber requested a review from a team as a code owner August 12, 2026 19:37
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.02%. Comparing base (bdccd1f) to head (b4f04e1).
⚠️ Report is 1 commits behind head on main.

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              
Files with missing lines Coverage Δ
...al/packages/configuration/src/FileConfigFactory.ts 97.97% <100.00%> (+0.20%) ⬆️
...s/opentelemetry-sdk-node/src/create-from-config.ts 94.96% <100.00%> (+0.07%) ⬆️
...ental/packages/opentelemetry-sdk-node/src/utils.ts 95.67% <ø> (-0.33%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Aug 12, 2026

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-08-12 21:33 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@trentm trentm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See a nit below.

Otherwise, LGTM.

@@ -495,13 +496,14 @@ export function getBatchLogRecordProcessorFromEnv(
}

export function getHeadersFromConfiguration(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Moved this to mergeHeadersConfig() in the configuration package.

);
});

it('parses headers_list and lets headers take precedence', function () {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... then this test could move to the configuration package.

@@ -510,16 +512,16 @@ export function getHeadersFromConfiguration(
}

export function getGrpcMetadataFromHeaders(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This could potentially move into create-from-config.ts.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@JacksonWeber
JacksonWeber added this pull request to the merge queue Aug 12, 2026
Merged via the queue into open-telemetry:main with commit b2ffd97 Aug 12, 2026
39 of 43 checks passed
@JacksonWeber
JacksonWeber deleted the jacksonweber/headers-list-6953 branch August 12, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[sdk-node] support headers_list when creating SDK exporters from declarative configuration

2 participants