Skip to content

✨ Collect WebSocket resource events#4718

Draft
bdibon wants to merge 1 commit into
boris.dibon/ws-4-track-configfrom
boris.dibon/ws-5-collection
Draft

✨ Collect WebSocket resource events#4718
bdibon wants to merge 1 commit into
boris.dibon/ws-4-track-configfrom
boris.dibon/ws-5-collection

Conversation

@bdibon
Copy link
Copy Markdown
Contributor

@bdibon bdibon commented Jun 3, 2026

Motivation

Collect WebSocket connections and report them as RUM resource events, aggregating connection-level metrics.

Depends on the schema PR (#4716) and is kept in draft until it lands.

Changes

  • Add webSocketCollection, which aggregates per-connection metrics from webSocketObservable and emits a WEBSOCKET_COMPLETED lifecycle event.
  • Integrate into resourceCollection: assemble a websocket RumResourceEvent and skip websocket entries from the Resource Timing observer; add matchRequestResourceEntry.
  • Wire startWebSocketCollection into startRum, gated by trackWebSockets + the TRACK_WEB_SOCKETS flag.
  • Add Access-Control-Allow-Origin: * to the dev server to support local cross-origin WebSocket testing.

Test instructions

  • yarn test:unit --spec packages/rum-core/src/domain/webSocketCollection.spec.ts
  • yarn test:unit --spec packages/rum-core/src/domain/resource/resourceCollection.spec.ts

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

Copy link
Copy Markdown
Contributor Author

bdibon commented Jun 3, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@datadog-datadog-prod-us1-2
Copy link
Copy Markdown

datadog-datadog-prod-us1-2 Bot commented Jun 3, 2026

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 4 Pipeline jobs failed

DataDog/browser-sdk | check-schemas   View in Datadog   GitLab

See error Untracked changes detected in telemetryEvent.types.ts. Please run 'yarn json-schemas:sync' or revert the rum-events-format submodule change.

DataDog/browser-sdk | unit-bs: [chrome-desktop]   View in Datadog   GitLab

See error HTTP Error 429: Rate limit exceeded for BrowserStack sessions.

DataDog/browser-sdk | unit-bs: [chrome-mobile]   View in Datadog   GitLab

See error Rate limit exceeded while trying to access BrowserStack, resulting in HTTP 429 error.

View all 4 failed jobs.

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 83.75%
Overall Coverage: 76.77% (+0.05%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: adaf9f3 | Docs | Datadog PR Page | Give us feedback!

@cit-pr-commenter-54b7da
Copy link
Copy Markdown

cit-pr-commenter-54b7da Bot commented Jun 3, 2026

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 172.35 KiB 177.29 KiB +4.94 KiB +2.87%
Rum Profiler 7.88 KiB 7.88 KiB 0 B 0.00%
Rum Recorder 21.21 KiB 21.21 KiB -1 B -0.00%
Logs 54.84 KiB 54.84 KiB 0 B 0.00%
Rum Slim 130.26 KiB 135.04 KiB +4.79 KiB +3.67%
Worker 22.96 KiB 22.96 KiB 0 B 0.00%

@bdibon bdibon force-pushed the boris.dibon/ws-5-collection branch from f9f774b to f67e33e Compare June 4, 2026 09:16
@bdibon bdibon force-pushed the boris.dibon/ws-4-track-config branch from ec073a8 to 98e75c8 Compare June 4, 2026 09:16
Co-authored-by: Cursor <cursoragent@cursor.com>
@bdibon bdibon force-pushed the boris.dibon/ws-5-collection branch from f67e33e to adaf9f3 Compare June 4, 2026 12:30
@bdibon bdibon force-pushed the boris.dibon/ws-4-track-config branch from 98e75c8 to 1afcc3a Compare June 4, 2026 12:30
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.

1 participant