What gets generated
Backend SDK initialisation
# app/__init__.py — generated when nfr_sentry is enabled
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
from sentry_sdk.integrations.sqlalchemy import SqlalchemyIntegration
if os.environ.get("SENTRY_DSN"):
sentry_sdk.init(
dsn=os.environ["SENTRY_DSN"],
environment=os.environ.get("ENVIRONMENT", "production"),
release=os.environ.get("RELEASE_VERSION"),
traces_sample_rate=float(os.environ.get("SENTRY_TRACES_SAMPLE_RATE", "0.1")),
profiles_sample_rate=float(os.environ.get("SENTRY_PROFILES_SAMPLE_RATE", "0.05")),
integrations=[
FlaskIntegration(),
SqlalchemyIntegration(),
],
send_default_pii=False, # explicit per GDPR
before_send=_scrub_pii, # custom scrubber for known sensitive fields
)
The before_send hook scrubs known PII fields based on the entity model's PII classification — emails, phone numbers, IP addresses are stripped from error contexts before transmission.
Frontend SDK
Next.js instrumentation-client.ts and instrumentation.ts are generated, with source map upload wired into the build step. Source maps are uploaded to Sentry but not exposed publicly.
Mobile SDK (when Expo target enabled)
@sentry/react-native is wired with the same release tracking. Crash reports include device + OS context.
User context
After login, the user's anonymized ID + workspace ID are attached to the Sentry scope. Errors include the affected user without leaking PII.
Performance monitoring
Critical routes (auth, payment, checkout) have traces_sample_rate=1.0 overrides via decorators. Less-critical routes use the global sample rate (default 10%). Database queries get auto-instrumented via the SQLAlchemy integration.
Release tracking
Generated CI workflow includes a Sentry release step: create release, associate commits, upload source maps, finalise. Lets you click an error and see exactly which deploy introduced it.
What ships in docs/
docs/decisions/ADR-0015-monitoring-sentry.md— why Sentry over Datadog / New Relic for early-stage productsdocs/runbooks/error-spike-response.md— the on-call playbookdocs/setup/source-map-upload.md— CI setup for source maps + release tracking
Environment variables generated
SENTRY_DSN=https://...@sentry.io/...
SENTRY_AUTH_TOKEN=... # for source map uploads
SENTRY_ORG=your-org
SENTRY_PROJECT=your-project
ENVIRONMENT=production # development / staging / production
RELEASE_VERSION= # set by CI per build
SENTRY_TRACES_SAMPLE_RATE=0.1
Sentry documentation references
Internal links
- Slack integration — error-rate alerts route here
- for/cto covers operational concerns
- Internal tools use case
CTA
Try it — free plan, no credit card. archiet.com.
Generate a codebase with Sentry wired across backend + frontend + mobile, decide if it's the observability shape you'd ship.