Skip to content

Repository files navigation

Sentry Golden Path

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 test

npm test typechecks the copy-paste inits and runs scripts/check.mjs plus Staff-premise fixtures. A broken premise fails, including:

  • sampleRate above 0.1 or tracesSampleRate above 0.05 in the examples
  • session replay sampled on the happy path
  • missing beforeSend, maskPii, or sendDefaultPii: false
  • missing captureDomainError / domain + flow helpers
  • a real Sentry DSN, or links to other Tiago repos

What fails on purpose

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

Start

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.

Contents

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

Layout

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

Official references

Cited in the docs. Not dependencies. This kit stays copy-pasteable.

Optional background: Observabilidade no frontend (DEV).

Contributing

See CONTRIBUTING.md. Agent notes: AGENTS.md.

License

MIT. See LICENSE.

About

Staff guide to Sentry golden path — errors, tracing, releases, alerts, AI/LLM monitoring — implementation best practices.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages