mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat(analytics): build-time bake + telemetry depth (#336)
Bake PostHog + Sentry into the published Docker image (SNAPOTTER_ANALYTICS build arg, codegen script). Delete entire consent system. Move event emission to BullMQ worker. Add cross-tier identity stitching, Sentry performance tracing on both tiers, frontend funnel events. Fix stateful regex bug. 86 files changed, 1593 insertions(+), 3747 deletions(-)
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
// AUTO-GENERATED by scripts/bake-analytics.mjs -- do not edit manually
|
||||
export const ANALYTICS_BAKED = {
|
||||
enabled: false,
|
||||
posthogApiKey: "",
|
||||
posthogHost: "",
|
||||
sentryDsn: "",
|
||||
sampleRate: 0,
|
||||
} as const;
|
||||
@@ -1,14 +0,0 @@
|
||||
import type { ConsentState } from "./types.js";
|
||||
|
||||
export function shouldShowConsent(consent: ConsentState, serverEnabled: boolean): boolean {
|
||||
if (!serverEnabled) return false;
|
||||
if (consent.analyticsEnabled !== null) return false;
|
||||
if (consent.analyticsConsentShownAt === null) return true;
|
||||
if (consent.analyticsConsentRemindAt === null) return false;
|
||||
return Date.now() >= consent.analyticsConsentRemindAt;
|
||||
}
|
||||
|
||||
export function isConsentEnabled(consent: ConsentState, serverEnabled: boolean): boolean {
|
||||
if (!serverEnabled) return false;
|
||||
return consent.analyticsEnabled === true;
|
||||
}
|
||||
@@ -1,8 +1,16 @@
|
||||
export const ANALYTICS_EVENTS = {
|
||||
TOOL_USED: "tool_used",
|
||||
TOOL_OPENED: "tool_opened",
|
||||
FILE_ADDED: "file_added",
|
||||
TOOL_STARTED: "tool_started",
|
||||
TOOL_CLIENT_ERROR: "tool_client_error",
|
||||
RESULT_DOWNLOADED: "result_downloaded",
|
||||
RESULT_SAVED: "result_saved",
|
||||
SEARCH: "search",
|
||||
PIPELINE_EXECUTED: "pipeline_executed",
|
||||
AI_BUNDLE_ACTION: "ai_bundle_action",
|
||||
AI_BUNDLE_PROMPTED: "ai_bundle_prompted",
|
||||
BATCH_PROCESSED: "batch_processed",
|
||||
} as const;
|
||||
|
||||
export type AnalyticsEvent = (typeof ANALYTICS_EVENTS)[keyof typeof ANALYTICS_EVENTS];
|
||||
|
||||
@@ -6,9 +6,3 @@ export interface AnalyticsConfig {
|
||||
sampleRate: number;
|
||||
instanceId: string;
|
||||
}
|
||||
|
||||
export interface ConsentState {
|
||||
analyticsEnabled: boolean | null;
|
||||
analyticsConsentShownAt: number | null;
|
||||
analyticsConsentRemindAt: number | null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user