RUM drops XHR resources when two requests with the same method start in the same millisecond (resource key collision)
维护者通常 2 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 85/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- react-native, typescript
调研方向
检查 packages/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.ts 中的密钥生成和 resource 报告机制。跟踪 proxyOpen 和 reportXhr,然后让每个打开的 XHR 都携带唯一的 resource 标识符,使使用相同方法的并发请求获得不同的 RUM 密钥。使用现有的 XHRProxy 测试或专门的复现用例进行验证,确认同一毫秒内的所有并行请求都被报告。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
XHRProxy builds the RUM resource key from the start timestamp (millisecond precision) and the HTTP method only:
// packages/core/src/rum/instrumentation/resourceTracking/requestProxy/XHRProxy/XHRProxy.ts
const key = `${context.timer.startTime}/${context.method}`;
ResourceReporter then calls DdRum.startResource(key, …) / DdRum.stopResource(key, …) with that key. When two requests with the same method start in the same millisecond, which is common when a screen fires a burst of parallel GETs, they get the same key. Only one of them ends up as a RUM resource; the other is silently dropped.
The same logic is still on develop (checked October 2026), so newer releases up to 3.10.0 appear to have it too.
Reproduction steps
- Fire several GET requests in parallel through XHR (axios here) when a screen mounts. Some of them start in the same millisecond.
- Compare the RUM resources for the session with an independent network capture: the backend logs, or a second RUM tool capturing the same requests.
- Requests that share a start millisecond and method with another request are missing from Datadog.
SDK logs
One session, Android, ~68 requests, compared against a second RUM SDK capturing the same requests. Datadog missed 4, and each one started in the same millisecond as another GET that Datadog kept:
| Missing in Datadog | Start (ms) | Same-ms GET that was recorded |
|---|---|---|
GET /eds/v2/???/<id> |
.937 | GET /api/2.0/??? |
GET /api/4.0/???/history |
.682 | GET /api/4.0/??? |
GET /???/api/v1/???/settings |
.683 | GET /api/2.0/??? |
GET /api/2.0/???? |
.931 | GET /api/2.0/???/.../??? |
All 4 returned 200 in 0.4–1.0s. Nothing filters them (no resourceEventMapper). The loss repeats across sessions, roughly 4–6% of requests on screens that load many endpoints at once.
Expected behavior
Every completed XHR is reported as its own RUM resource, however many requests start in the same millisecond.
Make the key unique per request, e.g. by adding a module-level counter (or a random ID) when the XHR is opened:
let resourceSequence = 0;
// in proxyOpen, store a unique id on _datadog_xhr:
this._datadog_xhr = { /* … */, resourceId: ++resourceSequence };
// in reportXhr:
const key = `${context.timer.startTime}/${context.method}/${context.resourceId}`;
Affected SDK versions
@datadog/mobile-react-navigation: 3.5.3
Latest working SDK version
@datadog/mobile-react-navigation: 3.5.3
Did you confirm if the latest SDK version fixes the bug?
Yes
Integration Methods
NPM
React Native Version
- React Native 0.81.4, New Architecture (Fabric)
Package.json Contents
@datadog/mobile-react-navigation: 3.5.3
iOS Setup
No response
Android Setup
No response
Device Information
- Android 16 (Samsung SM-S926B). Not yet verified on iOS, but the key logic is shared JS.
Other relevant information
No response
- 主要语言
- TypeScript
- 星标
- 146
- 派生
- 67
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 23
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DataDog/dd-sdk-reactnative 的其他 Issue
-
bug
难度 3/5 1-2 天 新手友好度 68/100
DataDog/dd-sdk-reactnative#1499 · 1 条评论 ·
维护者通常 2 天内回复
-
[actionNameAttribute] prop doesn't accept value with curly braces可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug
难度 3/5 1-2 天 新手友好度 62/100
DataDog/dd-sdk-reactnative#1486 · 4 条评论 ·
维护者通常 2 天内回复
-
Expose Android app startup Activity filtering in the React Native SDK可能已有人在做 @sbarrio 于 12 天前认领。 未关闭enhancement
难度 4/5 3-5 天 新手友好度 35/100
DataDog/dd-sdk-reactnative#1485 · 1 条评论 · 已指派 1 人 ·
维护者通常 2 天内回复
-
GraphQL variables with non-ASCII contents will make Apollo Client request throw error可能已有人在做 @cdn34dd 于 14 天前认领。 未关闭awaiting response bug
难度 4/5 3-5 天 新手友好度 42/100
DataDog/dd-sdk-reactnative#1482 · 2 条评论 · 1 个 reaction · 已指派 1 人 ·
维护者通常 2 天内回复
-
Interaction tracking records nothing: the babel plugin's injected import makes Metro bundle a second copy of the SDK, so DdBabelInteractionTracking.config is set on a different class than instrumented handlers call可能已有人在做 @cdn34dd 于 12 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 48/100
DataDog/dd-sdk-reactnative#1377 · 1 条评论 · 1 个 reaction · 已指派 1 人 ·
维护者通常 2 天内回复
查看 DataDog/dd-sdk-reactnative 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
endora-commerce/endora-commerce#397 ·
维护者通常 1 天内回复
-
level/task
难度 2/5 1-3 小时 新手友好度 68/100
wazuh/wazuh-dashboard-plugins#9472 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 63/100
维护者通常 1 天内回复
-
ready-for-agent
难度 2/5 1-3 小时 新手友好度 68/100
xavxyz/bei-shan-lin-shui#57 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
opennextjs/opennextjs-cloudflare#1461 ·
维护者通常 1 天内回复