Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tracer): forward X-Amzn-Trace-Id header when instrumenting fetch #3470

Merged
merged 3 commits into from
Jan 14, 2025

Conversation

dreamorosi
Copy link
Contributor

Summary

Changes

Please provide a summary of what's being changed

This PR updates the implementation of the global fetch instrumentation in Tracer so that the X-Amzn-Trace-Id header is automatically populated and added to requests when Tracer is enabled.

This allows X-Ray to attribute the segment/span to the correct parent and build the correct service map for a request.

Prior to this PR the header was not added and this resulted in disjointed traces. This happened only when using the Fetch API, but not when using the https module - which is why this is considered a bug.

The linked issue contains more info on why we did not add this in the first place and what was missing.

Please add the issue number below, if no issue is present the PR might get blocked and not be reviewed

Issue number: fixes #3467


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@dreamorosi dreamorosi self-assigned this Jan 14, 2025
@dreamorosi dreamorosi requested review from a team as code owners January 14, 2025 10:29
@boring-cyborg boring-cyborg bot added tests PRs that add or change tests tracer This item relates to the Tracer Utility labels Jan 14, 2025
@pull-request-size pull-request-size bot added the size/M PR between 30-99 LOC label Jan 14, 2025
@dreamorosi dreamorosi requested a review from am29d January 14, 2025 10:29
@github-actions github-actions bot added bug Something isn't working labels Jan 14, 2025
Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

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

Hi @dreamorosi! The TS implementations look good to me, the only thing is that it makes sense for us to check if it makes sense (and if it is possible) to keep the arbitrary fields.

@dreamorosi dreamorosi merged commit 4eb3e2d into main Jan 14, 2025
38 checks passed
@dreamorosi dreamorosi deleted the fix/tracer_fetch_headers branch January 14, 2025 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size/M PR between 30-99 LOC tests PRs that add or change tests tracer This item relates to the Tracer Utility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: fetch requests don't forward X-Ray trace header
3 participants