Repository navigation
✨ Report WebSocket silences and send queue depth, and protect WebSocket vitals in beforeSend - #5096
Conversation
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 1 Pipeline job failed
ℹ️ InfoNo other issues found (see more)🧪 All tests passed 🔄 Datadog auto-retried 1 job - 1 passed on retry 🎯 Code Coverage (details) Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: da81893 | Docs | View more details | Give us feedback! |
Bundles Sizes Evolution
|
950c462 to
76590b9
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 76590b933d
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…nnection Each direction now reports the time from the open date to its first message, and longest_silence counts the gap still open when the snapshot is read: at the pulse while open, so a quiet connection grows its silence across pulses, and at the tracking end once closed. The closed vital also reports the silence before close. Co-authored-by: Cursor <cursoragent@cursor.com>
The closed vital reports buffered_amount_at_close: the queue depth the close event carried, or the one read from the socket when tracking ended without a close event. Bytes still queued at close are payloads the application sent that may never have reached the server. Co-authored-by: Cursor <cursoragent@cursor.com>
The backend derives each connection from its whole vital stream, so dismissing some of its vitals would corrupt it. Like view events, a WebSocket vital beforeSend returns false for is kept, with a warning. To collect none, leave betaTrackWebSockets off. Co-authored-by: Cursor <cursoragent@cursor.com>
The fields that can carry customer data are modifiable from beforeSend: the url, the requested and selected protocols (often used to pass tokens) and the close reason. Every other WebSocket vital field stays read-only. Co-authored-by: Cursor <cursoragent@cursor.com>
A quiet connection grows longest_silence across pulses, beforeSend cannot dismiss WebSocket vitals but can redact their sensitive fields, and changes to any other field are ignored. Co-authored-by: Cursor <cursoragent@cursor.com>
76590b9 to
da81893
Compare
Motivation
Completes the snapshot with the metrics that depend on when it is read or when tracking ended, and protects the vital stream in
beforeSend: the backend derives each connection from all its vitals, so a dismissed one would corrupt it, while a few fields can carry customer data and must stay redactable.Part of the WebSocket vitals stack. Every PR targets the previous one; the first one targets the
boris.dibon/websocket-vitalsintegration branch, which is merged intomainin one go once the whole stack is approved. #5055 stays open as the reference implementation: the tip of this stack is content-identical to it, rebased on the currentmain.Changes
Commit by commit:
time_to_first_messageper direction.longest_silencenow counts the gap still open when the snapshot is read: at the pulse while open (so a quiet connection grows its silence across pulses), at the tracking end once closed. The closed vital addssilence_before_close.buffered_amount_at_closeon the closed vital, from the close event, or read from the socket when tracking ended without one.beforeSendreturnsfalsefor is kept, with a warning.vital.websocket.url,requested_protocols,selected_protocolandclose_reasonare modifiable; every other field stays read-only. ThebetaTrackWebSocketsdoc says so.Test instructions
yarn test:unit --spec "packages/browser-rum-core/src/domain/webSocket/*.spec.ts" --spec packages/browser-rum-core/src/browser/webSocketObservable.spec.ts --spec packages/browser-rum-core/src/domain/assembly.spec.tsyarn test:e2e -g "rum websockets"Note
check-staging-mergeis expected to fail:staging-40already contains the earlier merge of #5055, which touches the same files. It clears at the next staging bump; the other checks should be green.Checklist