This repository was archived by the owner on Jan 23, 2026. It is now read-only.
Repository navigation
Fixed issue where some outbound API requests dont have correct otel headers #197
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Verify trace header override behavior.
The trace context injection occurs after custom headers are copied (lines 142-144), which means
propagation.injectwill overwrite anytraceparentor other trace headers passed inrequest.headers.However, the test at lines 688-706 in
test/apis/api.test.tsexpects existing trace headers to be preserved. If there's an active OpenTelemetry context, thepropagation.injectcall will replace the customtraceparentheader, potentially causing the test to fail in scenarios with an active trace context.Run the following script to verify the test expectations:
🏁 Script executed:
Length of output: 724
🏁 Script executed:
Length of output: 1352
🏁 Script executed:
Length of output: 60
Prevent trace header override
The injected setter must only add missing headers—otherwise
propagation.injectwill overwrite any customtraceparent. Change to:This ensures existing trace headers in
request.headersare preserved.🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we want it to override
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Length of output: 557
@jhaynie, understood! The current implementation is correct for your use case—when there's an active OpenTelemetry context, it should override any manually passed trace headers.
However, I noticed that the test "should preserve existing trace headers passed in request" (lines 688-706 in
test/apis/api.test.ts) might be misleading. It currently passes because there's no active OpenTelemetry context set up in that test, sopropagation.injectdoesn't inject anything, leaving the customtraceparentintact.To properly test the override behavior, you might want to either:
context.with()to set up an active span)This will make the test suite more explicit about the intended behavior.
🧬 Code Graph Analysis Results
[src/apis/api.ts] lines 1-14
Reason: This defines the override mechanism for fetch, which directly relates to the user’s note “we want it to override.”
✏️ Learnings added