fix(instrumentation-fetch): do not consume Request before ignoreUrls - #7038
fix(instrumentation-fetch): do not consume Request before ignoreUrls#7038BetterAndBetterII wants to merge 3 commits into
Conversation
new Request(existing, init) locks the original body. Creating that clone before the span check meant ignored fetch(Request, init) calls threw when the wrapper forwarded the consumed Request. Fixes open-telemetry#7037 Signed-off-by: Yuzhong Zhang <BetterAndBetterII@users.noreply.github.com>
|
Welcome, contributor! Thank you for your contribution to opentelemetry-js. Important reminders:
|
Pull request dashboard statusWaiting on the author · refreshed 2026-09-02 19:23 UTC Respond to 1 review item (e.g. link a commit, explain why not, ask a follow-up):
Status above doesn't look right?
|
Keep _createSpan after new Request so a constructor throw cannot leave a span open. Signed-off-by: Yuzhong Zhang <BetterAndBetterII@users.noreply.github.com>
|
ignoreUrls is now checked first, and _createSpan runs after new Request, so a constructor throw cannot leave a span open. Added a regression test for that path. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7038 +/- ##
==========================================
- Coverage 94.99% 94.97% -0.03%
==========================================
Files 409 409
Lines 14338 14344 +6
Branches 3280 3284 +4
==========================================
+ Hits 13621 13623 +2
- Misses 717 721 +4
🚀 New features to boost your workflow:
|
| } | ||
| const createdSpan = plugin._createSpan(url, options); | ||
|
|
||
| const createdSpan = plugin._createSpan( |
There was a problem hiding this comment.
Could we pass options to _createSpan here? Reading args[1].method again can trigger getters twice and cause unexpected errors.
Fixes #7037. Delay Request clone until after the ignoreUrls span check so fetch(Request, init) does not throw on ignored URLs.