Skip to main content

Sentry

Application monitoring that automatically captures errors, performance issues, and user context from every layer of your stack. Sentry gives you full stack traces, breadcrumbs, session replay, and release-level regression tracking — so you spend less time reproducing bugs and more time fixing them.

✓ Automatic exception capture ✓ Distributed tracing ✓ Session replay on error ✓ Release tracking

What is Sentry?

Sentry is an open-source error monitoring and performance observability platform. Its SDK runs inside your application and automatically intercepts unhandled exceptions, Promise rejections, and crashed processes — capturing the full stack trace, request context, user info, and a trail of breadcrumbs showing what the user did before the error occurred.

Beyond errors, Sentry's performance module wraps your HTTP handlers, database queries, and async operations as spans, assembling them into distributed traces. You can find which endpoint is slow, which database query runs 500 times per request, and how a deployment correlated with a latency spike.

Key Features

SDK Initialization

// Sentry SDK initialization (Next.js / React)
import * as Sentry from '@sentry/nextjs';

Sentry.init({
  dsn: 'https://@o.ingest.sentry.io/',
  environment: process.env.NODE_ENV,
  release: process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA,
  tracesSampleRate: 1.0,      // 100% in dev; use 0.1–0.2 in prod
  profilesSampleRate: 1.0,    // Profiling (requires tracing enabled)
  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1.0, // Always capture replays on error
  integrations: [
    Sentry.replayIntegration(),
    Sentry.browserTracingIntegration(),
  ],
});

Manual Capture & Context

// Manual error capture with context
try {
  await processOrder(orderId);
} catch (err) {
  Sentry.withScope((scope) => {
    scope.setTag('flow', 'checkout');
    scope.setUser({ id: user.id, email: user.email });
    scope.setExtra('orderId', orderId);
    scope.setLevel('error');
    Sentry.captureException(err);
  });
  throw err;
}

// Breadcrumbs for context trail
Sentry.addBreadcrumb({
  category: 'ui.click',
  message: 'User clicked checkout',
  level: 'info',
});

// Performance transaction
const transaction = Sentry.startTransaction({ name: 'process-payment' });
const span = transaction.startChild({ op: 'stripe.charge' });
await stripe.charges.create(chargeData);
span.finish();
transaction.finish();

SDK Installation (Common Platforms)

# Next.js
npx @sentry/wizard@latest -i nextjs

# Node.js / Express
npm install @sentry/node @sentry/profiling-node

# React
npm install @sentry/react

# Python (Django / FastAPI)
pip install sentry-sdk[fastapi]

# Go
go get github.com/getsentry/sentry-go

Sampling Strategy

Setting Recommended Notes
tracesSampleRate0.1 – 0.2 in prod10–20% of requests; use dynamic sampler for precision
replaysSessionSampleRate0.05 – 0.15–10% of sessions for baseline
replaysOnErrorSampleRate1.0Always capture replays on error
profilesSampleRate0.1 in prodCPU profiling; subset of traced transactions
Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →