Skip to content

Epic: PostHog consolidation — errors, analytics, replay, AI observability (Sentry/Umami sunset) #8286

Description

@JSONbored

Why

We currently run three observability/analytics systems side by side:

  1. Sentry — error tracking across six independent, DSN-gated surfaces:
    • ORB self-host serversrc/selfhost/sentry.ts (opt-in SENTRY_DSN): the largest integration — key/payload/value redaction pipeline, structured-log forwarding (console wrap in src/server.ts), SENTRY_MIN_SEVERITY/SENTRY_REPO_MIN_SEVERITY thresholds, five cron monitors via captureCheckIn (SENTRY_MONITOR_NAMES: scheduled-loop, orb-export, orb-relay-drain, orb-relay-register, queue-dead-letter-revive), and an OpenTelemetry span bridge (buildSentryOpenTelemetryBridge).
    • ORB hosted Worker@sentry/hono/cloudflare middleware in src/api/routes.ts (opt-in WORKER_SENTRY_DSN).
    • Miner CLIpackages/loopover-miner/lib/sentry.ts (opt-in LOOPOVER_MINER_SENTRY_DSN; an operator points at their own project — nothing phones home by default, docs(selfhost): add combined ORB + AMS quickstart #6011).
    • discovery-index Workerpackages/discovery-index/src/sentry.ts, currently reporting into the shared metagraphed Sentry project rather than anything loopover-owned, plus a full @sentry/cli release/sourcemap pipeline (src/upload-sourcemaps.ts, scripts/validate-sentry-release.mjs, scripts/validate-sourcemaps.mjs).
    • review-enrichment servicereview-enrichment/src/sentry.ts + its own validate-sentry-release.mjs/validate-sourcemaps.mjs.
    • UI browserapps/loopover-ui/src/lib/browser-sentry.ts (opt-in VITE_SENTRY_DSN, @sentry/react) + .github/workflows/ui-sentry-release.yml + SENTRY_BUILD_SOURCEMAPS in vite.config.ts.
  2. PostHog — already live, but for MCP telemetry only: src/mcp/telemetry.ts (Spec: usage-telemetry instrumentation strategy for MCP (PostHog) #6228/feat(mcp): add a typed PostHog wrapper module for src/mcp/server.ts (remote) #6235 — hosted MCP tool-call events under a strict typed field allowlist, POSTHOG_API_KEY/POSTHOG_HOST) and packages/loopover-mcp/lib/telemetry.ts (feat(mcp): instrument the local MCP tool-dispatch chokepoint with PostHog events (opt-in) #6238 — the opt-in stdio CLI equivalent), surfaced in the UI via mcp-tool-usage-card.tsx.
  3. Umami (self-hosted) — UI pageview analytics through the first-party /stats proxy (apps/loopover-ui/src/lib/analytics-proxy.ts), local-beacon pattern with a deliberate no-third-party-script posture.

Three platforms means three dashboards, three mental models, and no correlation between "what breaks" (Sentry), "what users do" (PostHog), and "who visits" (Umami). PostHog now covers all three domains — plus session replay, feature flags, and AI/LLM observability — on one platform with one event store, and the free-tier headroom is materially better where it matters (error tracking: 100k exceptions/mo free vs Sentry's 5k/mo + 1-seat cap).

This is the same consolidation metagraphed is mid-flight on (JSONbored/metagraphed#7757). This epic deliberately mirrors its shape and reuses its shipped patterns, adapted to loopover's different topology: metagraphed is all-Workers, while loopover adds a Node self-host server, a published miner CLI with an opt-in posture, and two small standalone services.

Principles (apply to every sub-issue)

  • Parallel-run before cutover. Sentry and Umami keep running until the PostHog replacement has demonstrably captured the same class of signal. Decommission is its own gated sub-issue, never a side effect of any other PR.
  • Opt-in stays opt-in. Self-host operators (SENTRY_DSN) and miner operators (LOOPOVER_MINER_SENTRY_DSN) opt in and point at their own project; swapping vendor must not change the no-phone-home default (docs(selfhost): add combined ORB + AMS quickstart #6011/feat(mcp): add a typed PostHog wrapper module for src/mcp/server.ts (remote) #6235's posture). The loopover-owned project (Provision a loopover-owned Posthog project for the hosted fleet #7875) serves the hosted fleet, our own Workers, and our own UI deploy — not self-hosters.
  • No SDK in Worker bundles. posthog-node stays out of Workers — Worker-side capture uses PostHog's raw capture HTTP API (pattern: feat(observability): add PostHog error tracking via raw $exception capture metagraphed#7777). The Node server and miner CLI may use posthog-node (already a root dependency via MCP telemetry); the UI uses posthog-js, measured against the existing bundle-size CI gate.
  • Redaction is non-negotiable. Every new capture surface ports an existing, proven redaction pipeline (src/selfhost/sentry.ts's SECRET_KEY/PAYLOAD_KEY/SECRET_VALUE + PUBLIC_LOCAL_PATH_SCRUB_PATTERN scrubbing, or the typed-allowlist approach of src/mcp/telemetry.ts) to the PostHog sink — never re-derives one from scratch.
  • Billing limits first. Before each new capture surface goes live, set a per-product billing limit in PostHog. Web analytics + error events share the Product Analytics event pool with the existing MCP telemetry — watch combined volume.
  • First-party endpoints. Browser-side capture goes through a first-party proxy on our own origin, the same posture analytics-proxy.ts already proves out for Umami.
  • One taxonomy. $-prefixed PostHog-native events where PostHog defines a shape ($exception, $pageview, $ai_generation); snake_case custom events otherwise; existing MCP event names unchanged.

Phases

Sub-issues are tracked as native GitHub sub-issues of this epic, with blocked-by relationships encoding the real order:

  • Phase 0 — Foundation: Provision a loopover-owned Posthog project for the hosted fleet #7875 (a real loopover-owned PostHog project + key in the control-plane secret broker). Everything below is blocked on it.
  • Phase 1 — Errors (parity): one sub-issue per Sentry surface (six), plus the hosted-fleet wiring (Wire hosted control-plane + tenant containers to report to the central PostHog project (implements #4934) #7876, reworked from its Sentry framing per its own migration note).
  • Phase 2 — Analytics: Umami → PostHog web analytics behind the first-party proxy; insights/dashboards/alert routing.
  • Phase 3 — Depth: session replay; AI observability ($ai_generation over the ORB's review-pipeline AI calls); one combined evaluation spike (feature flags vs the config-as-code mandate, Logs, Data Warehouse).
  • Phase 4 — Sunset: Sentry decommission (gated checklist); Umami decommission (gated); tracing deferral tracked for PostHog-tracing GA.

Expected outcomes

  • One platform for errors, usage analytics, web analytics, replay, and AI observability, correlated per session/caller.
  • Error-tracking headroom ~20x the current Sentry free tier, without the single-seat cap.
  • discovery-index stops reporting into metagraphed's Sentry project and gets a loopover-owned home.
  • Two fewer systems to operate once the sunset gates pass.

Out of scope

  • Distributed tracing/APM until PostHog tracing is GA. Self-host OTLP export (src/selfhost/otel.ts) is vendor-independent and unaffected either way — only the Sentry span bridge is in scope, and only at decommission time (deferred sub-issue).
  • metagraphed's own migration (tracked in its repo).
  • Changing what data is collected: this epic swaps sinks and adds analytics surfaces; the MCP telemetry allowlist and the opt-in postures stay exactly as ratified.

Resources

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions