Repository navigation
refactor(datadog): remove shouldKeepEvent's instance-endpoint gate, which no RUM error can reach - #1807
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request removes the logic in 'shouldKeepEvent' that discarded 5xx errors, timeouts, and network failures targeting instance or cluster operation endpoints based on 'error.resource.url'. Since the browser RUM SDK does not populate 'error.resource' for these handled request failures, this endpoint-based filtering was ineffective. The corresponding tests and documentation have been updated to reflect that these events are now kept. As there are no review comments, no additional feedback is provided.
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
…hich no RUM error can reach The two branches gated on `error.resource.url` matching `/(HDBInstance|Cluster)/<id>/operation` never fire: the browser RUM SDK (7.15.0) records a failed request as a `resource` event, never as an error. `ErrorSource.NETWORK` is declared but nothing emits it, and `processError` builds no `error.resource`. Production agrees: 0 of 4,407 error events in the last 30 days carry `@error.resource.url` or `@error.source:network`, against 11,568 status-0 resources. Replaying 1,063 of those events through the old and new predicate gives the same verdict for all of them. The header now states what actually reaches the filter, so the next reader does not reason from a resource-error path that does not exist (as the #1680 review did). Console-relayed 5xx and `Network Error` AxiosErrors are still kept; whether to drop them is #1669. Closes #1690 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…io through the DOM guard frame GTM's LinkedIn Insight snippet calls `window.lintrk` before `snap.licdn.com` has loaded, and the `TypeError` was kept as a Studio error: 15 events, 4 sessions in 30 days, every one shaped `<anonymous>:1:8` -> `Node.insertBefore @ /assets/index-*.js` -> ~30 googletagmanager.com frames. Two frames on that stack scored as Studio's, and either one alone kept it: - `installBrowserTranslationDomGuard` (#1388) patches `Node.prototype.insertBefore` globally, so every script that inserts a node runs through it, and an inline `<script>` executes during the insertion. The guard lived in the app entry chunk, so its frame read as Studio code. - `www.googletagmanager.com` was not a known third-party host, so every GTM frame did too. `manualChunks` now builds the guard into `vendor-datadog`, the eager chunk `shouldKeepEvent` already treats as neutral instrumentation (the SDK's own fetch/XHR patches live there). Its frame is then recognised by URL in every browser, without trusting a function name: the guard's frame is named `Node.insertBefore`, `QI.Node.insertBefore` or `QI/Node.prototype.insertBefore` depending on the browser and build, and JavaScriptCore gives it no name at all. GTM's host joins `THIRD_PARTY_SCRIPT_FRAME`. Replaying 1,063 production error events with the guard frame moved to the new chunk changes 16 verdicts, all keep -> drop: the 15 `lintrk` events and one GTM-issued `Failed to fetch` that an extension blocked. A Studio error that passes through the guard still has React or Studio frames under it, so it is still kept. Closes #1696 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dawsontoth
added this pull request to stack #1922
October 12, 2026 20:40
dawsontoth
marked this pull request as ready for review
October 12, 2026 20:40
dawsontoth
force-pushed
the
claude/1690-drop-dead-endpoint-gate
branch
from
October 12, 2026 20:42
7e9a426 to
0c92d58
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📦 This PR now carries #1811 too
Rebased into 2 linear, signed commits on current
stage, with no merge commits and no conflicts: #1807 (removeshouldKeepEvent's instance-endpoint gate, Closes #1690) and #1811 (stop attributing GTM-injected vendor tag errors to Studio, #1696). Both PRs' changes are identical to what was reviewed. Gate on the final tree:tsc -b, oxlint,dprint check, vitest 474/474 files. It also merges cleanly alongside #1799.⊙ Problem
shouldKeepEventhad two branches that dropped 5xx, bare-timeout andNetwork Errorfailures whenerror.resource.urlmatched/(HDBInstance|Cluster)/<id>/operation. They never fire. The browser RUM SDK we ship (7.15.0) records a failed request as aresourceevent, never as an error, so no error event carrieserror.resource.urlorsource: 'network'. Production agrees: in the last 30 days, 0 of 4,407 error events had either field, against 11,568 status-0 resource events. The header described a "tracked resource error" path that does not exist, and the #1680 review reasoned from it.💡 Solution
Delete the dead branches and the
sourceread that only they used. Rewrite the header to say what reaches the filter: thrown exceptions (source),console.errorcalls (console),addError(custom) and browser reports (report). None of these names the failed request. Attribution is by message, name and stack only. An unreachable instance shows up only as@type:resource @resource.status_code:0.Behavior does not change for any event the SDK can produce. Console-relayed
Request failed with status code 5xxandNetwork ErrorAxiosErrors are still kept. Whether to drop them is #1669 (human required), and this PR leaves that choice to the owner.Closes #1690
🔧 Changes
src/integrations/datadog/shouldKeepEvent.ts: the twoisInstanceEndpointbranches and the unusedsourcelocal are removed. The header and the timeout-branch comment no longer describe an endpoint gate.src/integrations/datadog/shouldKeepEvent.test.ts: four tests that built impossible events (an error witherror.resource.url) and expected them to be dropped are replaced by arequest failuresblock. It pins that console-relayed 5xx/Network ErrorAxiosErrors are kept, and that anerror.resource.urlno longer changes the result.src/integrations/datadog/beforeSend.test.ts: only a comment changed. It said the filter coercesresource.url, which is no longer true. The test itself is unchanged.AGENTS.md: thebeforeSendordering note now says the filter attributes on the raw stack, withouterror.resource.url.src/integrations/datadog/beforeSend.ts's header still says the filter readserror.resource.url. I left it alone because fix(datadog): keep error causes that would need redaction out of Error Tracking #1799 is editing that file. It is a one-phrase fix for whichever PR lands second.✅ Verification
End-to-end route: not observable end-to-end. The removed branches cannot fire for any event the SDK produces. The evidence is the SDK source audit plus a replay of the production corpus:
@datadog/browser-rum7.15.0, resolved from thebrowser-rumentry):browser-rum-coreemits onlyErrorSource.AGENTandCUSTOM.browser-coreemitsSOURCE(trackRuntimeError),CONSOLE(consoleObservable) andREPORT(reportObservable).NETWORKis declared inerror.types.jsand never emitted.processError(errorCollection.js) builds noerror.resource, anderror.resource.urlappears only inassembly.js's modifiable-field allowlist.pup, read-only):@type:errorby@error.sourceisconsole4,188 /custom156 /source63, with nonetworkbucket.@error.resource.url:*returns 0 and@error.source:networkreturns 0.sourceerrors plus the 1,000 most recent other errors from the same 30 days went throughorigin/stage's predicate and this branch's. All 1,063 got the same verdict, and none carrieserror.resource.npx vitest run src/integrations/datadogpassed 8 files / 189 tests. Mutation check: withorigin/stage'sshouldKeepEvent.tsrestored, bothkeeps them with an error.resource.url of …cases fail (2 failed / 53 passed).npx tsc -bexit 0,npx oxlint --format stylish .exit 0,npx dprint checkexit 0, andcommitlintpassed on the message.--no-verifybecause of the machine, not the code. In the hook's fullpnpm test, 387/395 files passed. The other 15 tests, in 8 unrelated UI files, all timed out at 5000ms while the machine's load average was about 275 (other agents were running). Run alone, those 8 files passed 142/142. Later, at lower load, the fullnpx vitest runpassed 396 files / 3,674 tests on fix(datadog): stop attributing GTM-injected vendor tag errors to Studio through the DOM guard frame #1811's branch, which contains this commit unchanged.beforeSend.test.tscomment) and one gemini nit (a trimmed header aside) are fixed. Gemini'stype-vs-name"major" was rejected:errorEventbuildsevent.error, and the filter reads the thrown value's name fromevent.error.type(shouldKeepEvent.tsinterface anderrorName). The Cursor leg could not run (the 1Password SSH agent refused itsgit fetch). The Harper domain leg failed Claude OAuth. Both failures are infrastructure, not findings.🤖 Generated with Claude Code (Claude Opus 5.5); posted via @dawsontoth.
Related PRs: #1799 overlaps (open; also edits
shouldKeepEvent.ts's interface andbeforeSend.ts, different lines), 2 others independentComplexity: easy
Review-Coverage: authored=claude; ran=gemini,codex; blocked=cursor-composer(no-receipt),domain(auth); declined=cursor-grok,cursor-kimi,cursor-muse; rounds=1; full=1 @ 7e9a426
Review-Attention: read ~3m (raised: degraded review) @ 7e9a426