Skip to content

[NOJIRA] fix: resource key collision for same-millisecond requests - #1505

Merged
marco-saia-datadog merged 1 commit into
developfrom
marco.saia/fix-xhr-resource-key-collision
Oct 19, 2026
Merged

marco-saia-datadog merged 1 commit into
developfrom
marco.saia/fix-xhr-resource-key-collision

Conversation

@marco-saia-datadog

@marco-saia-datadog marco-saia-datadog commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Makes RUM resource keys unique per request. Each XHR and Fetch request now gets a counter-based ID, and the key becomes startTime/method/id.

Motivation

Fixes #1497.

The key used to be startTime/method. Two requests with the same method that started in the same millisecond got the same key, and one of them was dropped. This is common when a screen fires parallel GETs.

Additional Notes

  • Fixes both XHRProxy and FetchProxy.
  • The key is internal. Only startResource/stopResource use it, so nothing else changes.
  • Added XHR and Fetch tests that freeze Date.now and check that the two keys are different.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and thber (cf theCONTRIBUTING do
  • If this PR is auto-generated manually update the code relatedto the change

@marco-saia-datadog marco-saia-datadog changed the title [NOJIRA] fix: duplicated XHR resource keys [NOJIRA] fix: resource key collision for same-millisecond requests Oct 19, 2026
@marco-saia-datadog
marco-saia-datadog marked this pull request as ready for review October 19, 2026 13:22
@marco-saia-datadog
marco-saia-datadog requested a review from a team as a code owner October 19, 2026 13:22
Copilot AI balanced review requested due to automatic review settings October 19, 2026 13:22
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T13:24:59.166270Z 087f3ba Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The shared counter addresses collisions across both proxies, regression tests cover the reported scenario, and no blocking issues were identified.

No open issues 🎉

What changed in this PR

Fixes #1497 by preventing RUM resource-key collisions when requests share a method and start millisecond.

Changes:

  • Adds a shared request counter and resource-key helper.
  • Uses unique keys for XHR and Fetch reporting.
  • Adds same-millisecond regression tests for both proxies.
File Description
packages/​core/​src/​rum/​instrumentation/​resourceTracking/​requestProxy/​XHRProxy/​XHRProxy.ts Uses the shared resource-key helper.
packages/​core/​src/​rum/​instrumentation/​resourceTracking/​requestProxy/​XHRProxy/​__tests__/​XHRProxy.test.ts Tests distinct keys and matching resource starts/stops.
packages/​core/​src/​rum/​instrumentation/​resourceTracking/​requestProxy/​FetchProxy/​FetchProxy.ts Uses unique keys for successful and failed requests.
packages/​core/​src/​rum/​instrumentation/​resourceTracking/​requestProxy/​FetchProxy/​__tests__/​FetchProxy.test.ts Tests same-millisecond key uniqueness.
packages/​core/​src/​rum/​instrumentation/​resourceTracking/​requestProxy/​common/​RequestContext.ts Assigns request IDs and constructs unique keys.

Review effort: Balanced

@marco-saia-datadog
marco-saia-datadog merged commit 8b362d3 into develop Oct 19, 2026
16 checks passed
@marco-saia-datadog
marco-saia-datadog deleted the marco.saia/fix-xhr-resource-key-collision branch October 19, 2026 15:16
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.

RUM drops XHR resources when two requests with the same method start in the same millisecond (resource key collision)

4 participants