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.
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
- Error grouping — intelligent deduplication groups related stack traces, preventing notification floods
- Breadcrumbs — automatic trail of console logs, network requests, and navigation events leading up to the error
- Session Replay — DOM-mutation replay of user interactions at the moment an error occurred
- Performance tracing — distributed traces across frontend, API, and database layers
- Release tracking — tag errors with deployment releases; see exactly which release introduced a regression
- Source maps — automatically unminifies JavaScript stack traces for readable line-level context
- Alerts — configurable alert rules (error rate, new issue, regression) routing to Slack, PagerDuty, or email
- 100+ integrations — GitHub, GitLab, Jira, Slack, PagerDuty, AWS, Vercel, and more
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 |
|---|---|---|
| tracesSampleRate | 0.1 – 0.2 in prod | 10–20% of requests; use dynamic sampler for precision |
| replaysSessionSampleRate | 0.05 – 0.1 | 5–10% of sessions for baseline |
| replaysOnErrorSampleRate | 1.0 | Always capture replays on error |
| profilesSampleRate | 0.1 in prod | CPU profiling; subset of traced transactions |
Related Products
on GumroadDeveloper Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →AI Prompt Engineering Toolkit
58 structured prompt templates for Claude, ChatGPT, and Gemini — organized by use case. Code Review, Debugging, Documentation, Architecture, and 10 model-specific tips. Stop writing prompts from scratch.
Buy on Gumroad →Developer Cheat Sheet Bundle
10 print-ready cheat sheets for the tools developers use every day: Git, Docker, Linux CLI, SQL, Regex, HTTP Status codes, VS Code shortcuts, Bash scripting, jq/JSON, and Markdown.
Buy on Gumroad →You Might Also Need
JSON Formatter & Validator
Format, beautify, and validate JSON online. Paste your JSON to instantly pretty-print it with 2-space, 4-space, or tab indentation. Minify JSON too. Free, runs in your browser.
Open free tool →
Regex Tester
Free regex tester. Test regular expressions against multiple strings with expected match/no-match assertions — see instant pass/fail results. Built-in presets for email, URL, IPv4, and phone. Pro: unl
Open free tool →
Base64 Encoder & Decoder
Free Base64 Encoder & Decoder. Convert text, images, and any file to Base64 and back. Supports URL-safe Base64, image data URIs, and file download from Base64. Runs 100% in your browser — no data sent
Open free tool →
More Free Tools
Related Articles
curl 深度使用手冊:API 測試從入門到進階
curl 是每位開發者必備的 CLI 工具。本文涵蓋 GET/POST/PUT/DELETE 請求、認證、header 設定、檔案上傳、除錯技巧,以及 REST API 測試的完整實戰範例。
Best AI Code Review Tools 2026: CodeRabbit, Sourcery, DeepCode & Bito Compared
Compare top AI code review tools for 2026: CodeRabbit, Sourcery, DeepCode, and Bito. Features, pricing, GitHub/GitLab integration, and choosing the right tool for your team.
AI Code Review Tools 2026: GitHub Copilot, CodeRabbit, Qodo Merge Ranked
Compare AI code review tools for 2026: GitHub Copilot code review, CodeRabbit, Qodo Merge, Sourcery, and PR-Agent. Pricing, accuracy, and GitHub integration.
AI Coding Tools Comparison 2026: GitHub Copilot vs Cursor vs Windsurf vs Cline
Comprehensive comparison of the best AI coding tools in 2026: GitHub Copilot, Cursor, Windsurf, and Cline. Pricing, features, model support, and real-world benchmarks.
AI Pair Programming in 2026: GitHub Copilot vs Cursor vs Claude Code
Master AI pair programming in 2026. Compare GitHub Copilot, Cursor, and Claude Code for autocomplete, chat, and agentic workflows. Includes setup guides and productivity tips.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$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.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →