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

🐛 Some requests being processed as both XHR and Fetch, produces duplicate headers #2940

Open
ValerieNayak opened this issue Aug 16, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@ValerieNayak
Copy link

Describe the bug
A clear and concise description of what the bug is and on which product (rum, logs).

This issue occurs on rum. Some requests generate headers in both traceXhr and traceFetch. These requests have duplicate headers.

x-datadog-origin: rum, rum
x-datadog-parent-id: 332227412463181825, 1741862826606084281
x-datadog-sampling-priority: 0, 0
x-datadog-trace-id: 916912013437384357, 7469972749533929927

To Reproduce
Steps to reproduce the behavior:

We know the steps are being processed through both traceXhr and traceFetch, but we don't have a reproduction at this point.

Expected behavior
A clear and concise description of what you expected to happen.

We expect that a single request outputs a single trace ID in request headers.

@ValerieNayak ValerieNayak added the bug Something isn't working label Aug 16, 2024
@cy-moi
Copy link
Contributor

cy-moi commented Aug 19, 2024

Hi @ValerieNayak ,
Would you mind to give us your init script or process (NPM, CDN async, etc.)? It looks like multiple sdks have been initiated. If you need help on setting up, do not hesitate to reach out to Datadog Support.

@ValerieNayak
Copy link
Author

Hi @cy-moi, thanks for your reply. We are initializing using NPM. We have already ruled out multiple initiations because we set a breakpoint at the init step in the code and confirmed that it is only being hit once. With additional breakpoints, we've identified that a single request is being traced through both traceFetch and traceXhr.

@ValerieNayak
Copy link
Author

Upon further investigation, we've seen that we're using isomorphic-fetch and this turns a fetch request into an xhr request. According to MDN dev docs on XMLHttpRequest: setRequestHeader() method,

If this method is called several times with the same header, the values are merged into one single request header.

Could we have it so Datadog is not double tracing in this case?

@cy-moi
Copy link
Contributor

cy-moi commented Sep 30, 2024

Hi @ValerieNayak ,

Thank you for reporting this. This is indeed a limitation of ours and we value your feedback very much. You can report a feature request with Datadog Support to help us prioritizing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants