fix(system): restore and harden frontend product-analytics capture#16569
Open
flcarre wants to merge 2 commits into
Open
fix(system): restore and harden frontend product-analytics capture#16569flcarre wants to merge 2 commits into
flcarre wants to merge 2 commits into
Conversation
A PostHog audit showed $exception capture was dark, Vue component errors and rage clicks were never recorded, and the error event was fired for every toast variant (success/info logged as errors). - usePosthog: enable capture_exceptions, capture_dead_clicks, rageclick and capture_performance.web_vitals in posthog.init (autocapture stays off) so the signals we rely on are code-owned, not dependent on remote config - utils/posthog: add capturePosthogException through the lazy, opt-out-aware client - main.ts: forward Vue app.config.errorHandler to PostHog - ErrorToast: only emit the error event for actual error variants - test: cover capturePosthogException Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
📄 OpenAPI Spec Changes❌ Failed to generate EE OpenAPI spec (EE branch: 🐋 Docker imagedocker run --pull=always --rm -it -p 8080:8080 --user=root -v /var/run/docker.sock:/var/run/docker.sock -v /tmp:/tmp ghcr.io/kestra-io/kestra-pr:16569 server local |
…sking rageclick: true is a no-op when autocapture: false — the rageclick detector in posthog-js relies on the autocapture click listener. Confirmed by 90 days of production data showing zero $rageclick events. Switch to a restricted autocapture config (click events only, a/button elements only) and add mask_all_text: true to prevent capturing element text content (flow names, namespace names, labels). This keeps rageclick detection functionally equivalent to the existing $dead_click capture, with the same GDPR exposure profile. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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.
Why
A PostHog product-analytics audit (production instances, recent versions incl. Kestra Cloud) showed we are blind to most frontend errors and to part of the user-frustration signal:
$exceptioncapture has been dark since ~May 18 — there is no global handler forwarding JS errors to PostHog, so we only ever recorded errors that happened to surface as a toast.window.onerror(Vue swallows them), so even basic render/lifecycle failures were invisible.autocapture: falsedisables the rageclick detector) — we only see fully-dead clicks.$exception.erroranalytics event was mislabeled:ErrorToast.vuefired atype: "ERROR"event for every toast variant, so success/info toasts (e.g. "copied logs to clipboard") were logged aserrorevents, polluting the error stream.What
composables/usePosthog.ts— make the signals we rely on code-owned and restore the missing ones inposthog.init:capture_exceptions,capture_dead_clicks,rageclick,capture_performance: { web_vitals: true }.autocapturestaysfalse(no DOM autocapture).utils/posthog.ts— addcapturePosthogException()that routes through the existing lazy/queue-gated client and respects the anonymous-usage opt-out.main.ts— wireapp.config.errorHandlertocapturePosthogExceptionso Vue component errors are captured (with the Vue errorinfo).components/ErrorToast.vue— only emit theerroranalytics event for actual error variants (varianterroror unset); success/info/warning toasts no longer count as errors.tests/unit/utils/posthog.spec.ts— covercapturePosthogException(captures when enabled, no-ops when disabled).Verification
npm run check:types✅ (design-system + app + test)npx oxlinton changed files ✅npx vitest run tests/unit/utils/posthog.spec.ts✅ (3/3)Related
Surfaced by the same audit (tracked separately as UX work):
Success-logged-as-errorpart is fixed here)