Skip to content

fix(sdk-node): support headers_list for log exporters - #6955

Closed
LarryHu0217 wants to merge 3 commits into
open-telemetry:mainfrom
LarryHu0217:codex/sdk-node-headers-list-6953
Closed

fix(sdk-node): support headers_list for log exporters#6955
LarryHu0217 wants to merge 3 commits into
open-telemetry:mainfrom
LarryHu0217:codex/sdk-node-headers-list-6953

Conversation

@LarryHu0217

Copy link
Copy Markdown
Contributor

Fixes #6953

Changes

  • parse declarative headers_list values using the existing percent-decoding key/value parser
  • merge explicit headers over headers_list, preserving the documented precedence
  • apply the merged values to HTTP headers and gRPC metadata for log exporters
  • mark headers_list as handled during exporter creation

Testing

  • focused sdk-node create-from-config and utils tests: 93 passing
  • sdk-node ESLint
  • strict no-emit TypeScript check for the touched header utility
  • git diff --check

@LarryHu0217
LarryHu0217 requested a review from a team as a code owner July 28, 2026 16:02
@codecov

codecov Bot commented Jul 28, 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 (76b0d92).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6955   +/-   ##
=======================================
  Coverage   95.02%   95.02%           
=======================================
  Files         409      409           
  Lines       14301    14301           
  Branches     3277     3277           
=======================================
  Hits        13590    13590           
  Misses        711      711           
Files with missing lines Coverage Δ
...s/opentelemetry-sdk-node/src/create-from-config.ts 94.89% <ø> (ø)
...ental/packages/opentelemetry-sdk-node/src/utils.ts 96.00% <100.00%> (ø)
🚀 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 Jul 28, 2026

Copy link
Copy Markdown

Pull request dashboard status

Closed · refreshed 2026-08-12 20:08 UTC

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

@pacocartones

Copy link
Copy Markdown

Independent verification

I checked out https://github.com/open-telemetry/opentelemetry-js/pull/6955 and ran the verification below. I am not the author of this change; this is an independent reproduction, offered in case it saves a reviewer some time.

rojo — src de main (636e27a) + test de la PR: no compila (la API no existe) (must fail without the fix)

$ cd experimental/packages/opentelemetry-sdk-node && npx tsc --build
test/utils.test.ts(694,9): error TS2554: Expected 1 arguments, but got 2.
test/utils.test.ts(709,7): error TS2554: Expected 1 arguments, but got 2.
[exit code 1]

verde — src de la PR (55c168c): build + suite utils compilada 64/64 (must pass) — 3 runs, identical exit code

$ cd experimental/packages/opentelemetry-sdk-node && npx mocha build/test/utils.test.js
[…]
  getIdGeneratorFromConfiguration
    ✔ returns undefined when no tracer_provider is set
    ✔ returns undefined when no id_generator is set
    ✔ returns a RandomIdGenerator when random is set
    ✔ warns and returns undefined for unsupported id_generator type
  getHttpAgentOptionsFromTls
    ✔ should return undefined if no TLS config is provided
    ✔ should return https agent options if TLS config is provided
    ✔ show warning messages for invalid ca file
    ✔ show warning messages for invalid ca-key file
    ✔ show warning messages for invalid cert file
  64 passing (209ms)
[exit code 0]
Environment and output hashes
so: Windows 11 (AMD64)
python: 3.13.14
node --version: v24.14.1
gh pr view 6955 --repo open-telemetry/opentelemetry-js --json headRefOid -q .headRefOid: 55c168c09d587a0c164ed99e077dbd045eba11b9
git rev-parse HEAD: 55c168c09d587a0c164ed99e077dbd045eba11b9
sha256(rojo — src de main (636e27aa) + test de la PR: no compila (la API no existe) run 1) = 9e90b5bc1338650e…  exit 1  6.91s
sha256(verde — src de la PR (55c168c0): build + suite utils compilada 64/64 run 1) = a88ba4c8678aaa47…  exit 0  6.43s
sha256(verde — src de la PR (55c168c0): build + suite utils compilada 64/64 run 2) = 3b1cb3ec98434d61…  exit 0  5.17s
sha256(verde — src de la PR (55c168c0): build + suite utils compilada 64/64 run 3) = 44fd7aa2ec0c984f…  exit 0  4.53s
acta: 5dbc768f8ddbfaad
---

Framing note: this is a feature PR, so there is no bug to reproduce — the honest "red" is that the new tests don't even compile against main (the API surface they exercise isn't there). The green is the full compiled utils suite, three runs.

(Verification block produced with a local harness that records commands, exit codes and output hashes — all re-runnable from the steps above.)

@LarryHu0217

Copy link
Copy Markdown
Contributor Author

Hi @open-telemetry/javascript-approvers, this PR is ready for review. The current hosted checks are green, and the focused parser/header tests are documented in the PR body. Please let me know if any changes or additional validation would help. Thank you.

Signed-off-by: Liang Hu <lh3057@columbia.edu>
Signed-off-by: Liang Hu <lh3057@columbia.edu>
@LarryHu0217
LarryHu0217 force-pushed the codex/sdk-node-headers-list-6953 branch from 55c168c to 2858a2f Compare August 10, 2026 18:48
…s-list-6953

# Conflicts:
#	experimental/packages/opentelemetry-sdk-node/src/create-from-config.ts
@LarryHu0217

Copy link
Copy Markdown
Contributor Author

Thanks for incorporating and extending the work from #6955 across all current exporter paths. #6997 covers the full issue with broader tests, so I’m closing this narrower PR in favor of it.

@JacksonWeber

Copy link
Copy Markdown
Contributor

@LarryHu0217 my apologies for swallowing this work into my PR, I didn't see this originally. Please let me know if you'd like to take back over or if there's anything I can do to help you reviews or PRs wise to make up for it!

@LarryHu0217

Copy link
Copy Markdown
Contributor Author

No worries at all, and thank you for expanding the fix and crediting #6955. #6997 is the stronger, complete solution, so please keep it moving forward. No need to hand it back.

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

3 participants