feat(telemetry): Sentry + PostHog quality pass (#546)

Comprehensive telemetry quality improvements across Sentry and PostHog, grounded in an audit of the live data plus current best-practice research.

Sentry: job_id/instance_id tags, operational fingerprinting, PII-safe settings context on bug events, web tag population + extension-noise filtering, an early-crash buffer, http status/method kept on breadcrumbs, and a gated-off-by-default performance-tracing re-enable (tracesSampler that zeroes db/redis/queue-poll root spans + drops the Redis integration) with worker job spans and canonical-host cron monitors.

PostHog: history_change SPA pageviews, instance_id super property for fleet rollups, enriched tool_used (formats, byte sizes, is_batch, execution_hint, real error_kind taxonomy), the previously-dead result_saved/batch_processed/ai_bundle_prompted events fired, search click-through, editor + Automate authoring + auth instrumentation, a before_send PII boundary, and minimal opt-in landing-site pageviews.
This commit is contained in:
SnapOtter
2026-07-17 01:51:48 +00:00
committed by GitHub
parent 9247947704
commit 86251434b5
36 changed files with 936 additions and 54 deletions
+19 -3
View File
@@ -2,22 +2,38 @@ import { describe, expect, it } from "vitest";
import { sanitizeEventProperties } from "../../../apps/api/src/lib/analytics-allowlist.js";
describe("sanitizeEventProperties", () => {
it("keeps only allow-listed keys for tool_used", () => {
it("keeps the enriched allow-listed keys for tool_used and drops free-text/PII", () => {
const out = sanitizeEventProperties("tool_used", {
tool_id: "resize",
status: "completed",
status: "failed",
duration_ms: 12,
category: "image",
is_ai_tool: false,
is_batch: true,
input_format: "heic",
output_format: "png",
bytes_in: 4096,
bytes_out: 2048,
execution_hint: "fast",
error_kind: "input",
error_code: "corrupt-header",
error_message: "stack with /uploads/secret.docx",
params: { watermark_text: "CONFIDENTIAL" },
});
expect(out).toEqual({
tool_id: "resize",
status: "completed",
status: "failed",
duration_ms: 12,
category: "image",
is_ai_tool: false,
is_batch: true,
input_format: "heic",
output_format: "png",
bytes_in: 4096,
bytes_out: 2048,
execution_hint: "fast",
error_kind: "input",
error_code: "corrupt-header",
});
expect(out).not.toHaveProperty("error_message");
expect(out).not.toHaveProperty("params");