Repository navigation
feat(telemetry): make Datadog the usable exception sink - #1541
Conversation
The renderer discarded the scrubbed error it had already built and reported a fixed "Desktop application exception" with no stack and no error_type, so every distinct failure collapsed into one Datadog error a monitor could not act on. Carry the scrubbed message, stack and the frontend's error_type slug through instead; context keys stay allow-listed, so free-form diagnostics still never reach Datadog. With Datadog carrying real detail, the PostHog copy is now opt-in behind POSTHOG_EXCEPTIONS: both sinks hold the same scrubbed error and PostHog bills per event.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughException telemetry now preserves scrubbed error details for renderer reporting. Datadog receives exceptions independently of the action allow-list. PostHog exception capture is opt-in through ChangesException telemetry
Sequence Diagram(s)sequenceDiagram
participant Renderer
participant MainTelemetry
participant Datadog
participant PostHog
Renderer->>MainTelemetry: report scrubbed exception
MainTelemetry->>Datadog: forward exception details
MainTelemetry->>PostHog: capture exception when POSTHOG_EXCEPTIONS is enabled
Suggested reviewers: Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to Datadog exception forwarding remains available as intended, and no actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
|
Admin-merged without waiting for in-band approval, same release window as #1485 and Comfy-Org/ComfyUI_frontend#16917. Authorized offline by me as the author. Stating it plainly: no human has reviewed this PR. A post-merge peer review is owed under CC8.1. CI was 15/15 green at merge, and the full unit suite (276 files, 5100 tests) passed locally. The one thing worth a reviewer's eye is the deliberate reversal of #1271's "no message or stack to Datadog" decision, explained in the PR body. Short version: that was right when PostHog held the error detail, and wrong now that Datadog is the primary exception sink and PostHog is opt-out. No new unscrubbed data reaches Datadog, it is the same scrubbed text PostHog was already receiving. @huang47 @benjcooley if either of you has ten minutes, the diff is ~20 executable lines across |
Exceptions reached Datadog already, but as a fixed string, so no monitor could tell one failure from another. This makes that payload usable and moves the PostHog copy behind an opt-in.
What was wrong
reportRendererErrorbuilds a scrubbed, length-cappedErrorfrom the forwarded payload, then throws it away:No message, no stack, and no
error_type. Every distinct failure mode collapsed into one indistinguishable Datadog error. You could alert on "desktop exceptions rose" and never on which one. That matters now that the hosted frontend routes everyreportError()through this path (#1485).Changes
forwardExceptionToRenderertakes the scrubbed error and forwards its message and stack. Context keys stay allow-listed;error_typeis added to that list. Free-form diagnostics still never reach Datadog.error_typethrough.POSTHOG_EXCEPTIONS=1. Both sinks carried the same scrubbed error and PostHog bills per event.Deliberate reversal, flagged for review
#1271 intentionally sent no message or stack to Datadog ("Forward scrubbed exception context (reason/exitCode/type) to the renderer Datadog mirror; keys stay allow-listed"). This reverses that half, on purpose, because Datadog is now the primary exception sink rather than a secondary mirror. Sending nothing identifiable was defensible when PostHog held the detail; it is not once PostHog is opt-out.
No new unscrubbed surface:
telemetry.tsis the onlydd-errorproducer, the payload isdeliverException'ssafeError(alreadyscrubAll-ed and capped), andreportRendererErrorscrubs again on receipt. This is the same text PostHog already received.Change breakdown
Total changed lines 143 (118 added, 25 deleted).
src/main/lib/telemetry.ts,src/renderer/src/lib/rendererBootstrap.ts,src/shared/posthogConfig.ts,src/types/ipc.tssrc/main/lib/telemetry.test.tsNo documentation, configuration, generated files, lockfiles, or vendored code. No merge-only changes.
The product-code count is inflated by comment and docstring updates inside those four files: the module header's provider-split section, the
DatadogForwardedError.skipPostHogdoc, and theforwardExceptionToRendererdocstring all described the old behaviour and would have been actively misleading if left. The executable change is roughly 20 lines.Verification
pnpm typecheck(node, web, e2e, integration) clean;pnpm lintclean;prettier --checkclean.New tests:
error_typeso a monitor can tell failures apartPOSTHOG_EXCEPTIONSopts in, while the Datadog forward still happensThe existing "forwards exceptions to Datadog without message, stack, or arbitrary context" test is renamed to "forwards a bare notice to Datadog when no error is supplied" and kept: it still pins the no-error call path and the context allow-list.
Justification: Merged without pre-merge approval under release time pressure, authorized offline by the author, to complete the Desktop error-reporting path landed in #1485 and Comfy-Org/ComfyUI_frontend#16917 before the release window closes. No human has reviewed this PR. Risk is limited: no new unscrubbed data reaches any sink, the only behaviour change to an existing path is richer detail on an error already being sent, full unit suite and all gates green. Post-merge peer review is owed.