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
+22 -3
View File
@@ -59,18 +59,22 @@ describe("buildBeforeSend (api)", () => {
);
expect(out.exception.values[0].stacktrace.frames[0].abs_path).toBe("/app/x");
});
it("keeps the breadcrumb trail, redacting paths/urls and dropping data payloads", () => {
it("keeps the breadcrumb trail, redacting urls but keeping safe http status/method", () => {
const out = send(
evt({
breadcrumbs: [
{ message: "GET https://host/u/photo.jpg 200", category: "http", data: { url: "x" } },
{
message: "GET https://host/u/photo.jpg 500",
category: "http",
data: { url: "https://host/u/photo.jpg", status_code: 500, method: "GET" },
},
{ message: "reading /Users/me/secret.txt", category: "console", level: "info" },
],
}),
{},
)!;
expect(out.breadcrumbs).toEqual([
{ message: "GET <url> 200", category: "http" },
{ message: "GET <url> 500", category: "http", data: { status_code: 500, method: "GET" } },
{ message: "reading <path>", category: "console", level: "info" },
]);
});
@@ -102,6 +106,21 @@ describe("buildBeforeSend (api)", () => {
expect(out.tags.input_format).toBe("webp");
expect(out.tags.secret_tag).toBeUndefined();
});
it("keeps job_id and instance_id tags for cross-referencing and blast-radius triage", () => {
const out = send(evt({ tags: { job_id: "j1", instance_id: "i1", secret_tag: "x" } }), {})!;
expect(out.tags.job_id).toBe("j1");
expect(out.tags.instance_id).toBe("i1");
expect(out.tags.secret_tag).toBeUndefined();
});
it("keeps a vetted tool context (primitives) and drops non-primitive fields", () => {
const out = send(
evt({
contexts: { tool: { format: "png", quality: 80, blob: { x: 1 }, long: "x".repeat(40) } },
}),
{},
)!;
expect(out.contexts.tool).toEqual({ format: "png", quality: 80 });
});
it("drops contexts entirely when nothing allowlisted survives", () => {
const out = send(evt({ contexts: { device: { hostname: "leak" } } }), {})!;
expect(out.contexts).toBeUndefined();