Skip to content

Stop using "any" as propagator generic - #6903

Open
matthieusieben wants to merge 4 commits into
open-telemetry:mainfrom
matthieusieben:propagator-typing
Open

Stop using "any" as propagator generic#6903
matthieusieben wants to merge 4 commits into
open-telemetry:mainfrom
matthieusieben:propagator-typing

Conversation

@matthieusieben

@matthieusieben matthieusieben commented Jul 9, 2026

Copy link
Copy Markdown

The current implementation of the http instrumentation incorrectly assumes that a request headers is always an object. However, NodeJS also allows using an array of strings as request.headers.

The any generic of the propagator classes hides the typing error this should normally generate:

Capture d’écran 2026-07-09 à 18 00 22

This PR fixes several things:

  1. It changes the typing of the propagation utilities to not rely on any as it may cause invisible issues
  2. It fixes the injection of propagation headers when the request options is an array
  3. It accounts for the fact that header names are case insensitive when setting propagation headers.

@matthieusieben
matthieusieben requested a review from a team as a code owner July 9, 2026 16:02
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

Welcome, contributor! Thank you for your contribution to opentelemetry-js.

Important reminders:

@matthieusieben
matthieusieben requested a review from a team as a code owner July 9, 2026 16:10
@matthieusieben
matthieusieben requested a review from a team as a code owner July 10, 2026 07:23
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Jul 18, 2026

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-07-30 13:48 UTC

Review the latest changes.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.59459% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.07%. Comparing base (e6a5776) to head (abe9b70).
⚠️ Report is 32 commits behind head on main.

Files with missing lines Patch % Lines
...es/opentelemetry-instrumentation-http/src/utils.ts 91.30% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6903      +/-   ##
==========================================
- Coverage   95.08%   95.07%   -0.01%     
==========================================
  Files         394      394              
  Lines       13997    14016      +19     
  Branches     3224     3227       +3     
==========================================
+ Hits        13309    13326      +17     
- Misses        688      690       +2     
Files with missing lines Coverage Δ
api/src/api/propagation.ts 100.00% <100.00%> (ø)
api/src/propagation/TextMapPropagator.ts 14.28% <100.00%> (ø)
...s/opentelemetry-instrumentation-fetch/src/fetch.ts 83.17% <100.00%> (ø)
...ges/opentelemetry-instrumentation-http/src/http.ts 93.41% <100.00%> (-0.08%) ⬇️
...emetry-instrumentation-xml-http-request/src/xhr.ts 93.22% <100.00%> (ø)
...entelemetry-propagator-b3/src/B3MultiPropagator.ts 100.00% <100.00%> (ø)
...es/opentelemetry-propagator-b3/src/B3Propagator.ts 100.00% <100.00%> (ø)
...ntelemetry-propagator-b3/src/B3SinglePropagator.ts 100.00% <100.00%> (ø)
...es/opentelemetry-instrumentation-http/src/utils.ts 87.15% <91.30%> (+0.28%) ⬆️

... and 1 file with indirect coverage changes

🚀 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.

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.

1 participant