This repository proves a conservative, copy-paste Sentry setup for front-end apps, and teaches the official distinctions behind it: sampleRate (errors) vs tracesSampleRate vs tracesSampler + inheritOrSampleWith; on-device beforeSend* before data leaves the machine; field Web Vitals (RUM) vs Lighthouse lab; Golden Signals Errors + sampled Latency here, Traffic / Saturation on a metrics backend. The proof is the runnable check. If an example drifts above the caps or drops beforeSend, the build fails.
Limit: this kit does not prove brand rates or a production org.
npm ci
npm testnpm test typechecks the copy-paste inits and runs scripts/check.mjs plus Staff-premise fixtures. A broken premise fails, including:
sampleRateabove 0.1 ortracesSampleRateabove 0.05 in the examples- session replay sampled on the happy path
- missing
beforeSend,maskPii, orsendDefaultPii: false - missing
captureDomainError/domain+flowhelpers - a real Sentry DSN, or links to other Tiago repos
scripts/fixtures/sampling-over-cap.ts is an anti-fixture: the wizard default tracesSampleRate: 1.0. The Staff check is expected to FAIL. Blast radius if that number landed in a copy-paste init:
check: scripts/fixtures/sampling-over-cap.ts: tracesSampleRate=1.0 exceeds conservative tracesSampleRate cap 0.05.
That is the point. Happy-path examples stay at 0.05 so this line does not ship.
What the docs actually teach (cited, not invented): wizard / SDK sampleRate: 1 and tracesSampleRate: 1.0 are a demo; the sampling-strategy post uses 0.05 traces in production and replay-on-error as a flight recorder; sendDefaultPii is deprecated in favor of explicit dataCollection opt-outs; Sentry's Web Vitals page is initial page-load only and drops samples missing a required vital.
Maintainer: Tiago Montanha · Staff · Observability
Copy examples/react-init.ts or examples/vue-nuxt-init.ts. LLM/agent spans: examples/agent-span.example.ts. Replace placeholders only (YOUR_ORG, your-app, https://oXXXX.ingest.sentry.io/...). New repo checklist: docs/golden-path.md.
| Doc | Use when |
|---|---|
| docs/golden-path.md | Why Sentry vs metrics backends; create project → SDK → env → production-only init; source maps; 15-minute checklist |
| docs/observability-map.md | Golden Signals, RED/USE, front-end SLIs (error-free sessions, LCP/INP, critical flow), error budget as release policy |
| docs/sampling.md | sampleRate vs tracesSampleRate vs tracesSampler + inheritOrSampleWith; wizard 1.0 vs prod; field Web Vitals |
| docs/pii-and-filters.md | beforeSend* on-device, no PII in breadcrumbs, sendDefaultPii deprecated → dataCollection opt-outs |
| docs/domain-tags.md | domain + flow tags with context; short-window dedup against cascade spam |
| docs/ai-llm-monitoring.md | LLM/agent gen_ai.* spans, prompts as PII, token/cost breadcrumbs, failure modes, sampling |
docs/ golden path, observability map, sampling, PII, domain tags, AI/LLM
examples/ typed init + agent span helpers (placeholders only)
scripts/ Staff-premise check + sampling-over-cap anti-fixture
llms.txt RAG pointer for coding agents
adapters/cursor/ optional Cursor rule; AGENTS.md stays source of truth
.github/ PR / issue templates + CI
Cited in the docs. Not dependencies. This kit stays copy-pasteable.
- Sentry sampling (JavaScript)
- A sampling strategy for Sentry
- Scrubbing sensitive data
- SDK options (
sendDefaultPii/dataCollection) - Sentry Web Vitals dashboard
- Web Vitals (web.dev)
- Golden Signals · Service Level Objectives
- Sentry for React · Vue · Nuxt · AI / agent tracing
Optional background: Observabilidade no frontend (DEV).
See CONTRIBUTING.md. Agent notes: AGENTS.md.
MIT. See LICENSE.