sentry
Use this skill when working with Sentry - error monitoring, performance tracing, session replay, cron monitoring, alerts, or source maps. Triggers on any Sentry-related task including SDK initialization, issue triage, custom instrumentation, uploading source maps, configuring alerts, and integrating Sentry into JavaScript, Python, Next.js, or other supported frameworks.
monitoring sentryerror-monitoringperformancetracingobservabilitydebuggingWhat is sentry?
Use this skill when working with Sentry - error monitoring, performance tracing, session replay, cron monitoring, alerts, or source maps. Triggers on any Sentry-related task including SDK initialization, issue triage, custom instrumentation, uploading source maps, configuring alerts, and integrating Sentry into JavaScript, Python, Next.js, or other supported frameworks.
sentry
sentry is a production-ready AI agent skill for claude-code, gemini-cli, openai-codex, and 1 more. Working with Sentry - error monitoring, performance tracing, session replay, cron monitoring, alerts, or source maps.
Quick Facts
| Field | Value |
|---|---|
| Category | monitoring |
| Version | 0.1.0 |
| Platforms | claude-code, gemini-cli, openai-codex, mcp |
| License | MIT |
How to Install
- Make sure you have Node.js installed on your machine.
- Run the following command in your terminal:
npx skills add AbsolutelySkilled/AbsolutelySkilled --skill sentry- The sentry skill is now available in your AI coding agent (Claude Code, Gemini CLI, OpenAI Codex, etc.).
Overview
Sentry is an application monitoring platform that provides real-time error tracking, performance monitoring, session replay, and cron job monitoring. It captures errors and exceptions with full stack traces, groups them into issues for triage, and provides distributed tracing to debug performance bottlenecks across your stack. Sentry supports 20+ platforms with dedicated SDKs for JavaScript, Python, Go, Ruby, Java, and more.
Tags
sentry error-monitoring performance tracing observability debugging
Platforms
- claude-code
- gemini-cli
- openai-codex
- mcp
Related Skills
Pair sentry with these complementary skills:
Frequently Asked Questions
What is sentry?
Use this skill when working with Sentry - error monitoring, performance tracing, session replay, cron monitoring, alerts, or source maps. Triggers on any Sentry-related task including SDK initialization, issue triage, custom instrumentation, uploading source maps, configuring alerts, and integrating Sentry into JavaScript, Python, Next.js, or other supported frameworks.
How do I install sentry?
Run npx skills add AbsolutelySkilled/AbsolutelySkilled --skill sentry in your terminal. The skill will be immediately available in your AI coding agent.
What AI agents support sentry?
This skill works with claude-code, gemini-cli, openai-codex, mcp. Install it once and use it across any supported AI coding agent.
Maintainers
Generated from AbsolutelySkilled
SKILL.md
Sentry
Sentry is an application monitoring platform that provides real-time error tracking, performance monitoring, session replay, and cron job monitoring. It captures errors and exceptions with full stack traces, groups them into issues for triage, and provides distributed tracing to debug performance bottlenecks across your stack. Sentry supports 20+ platforms with dedicated SDKs for JavaScript, Python, Go, Ruby, Java, and more.
When to use this skill
Trigger this skill when the user:
- Wants to set up Sentry in a new or existing project (any SDK)
- Needs to configure error monitoring, tracing, or session replay
- Asks about Sentry SDK initialization options (DSN, sample rates, integrations)
- Wants to upload source maps for readable stack traces
- Needs to set up alerts (issue, metric, uptime, or cron alerts)
- Asks about custom instrumentation - creating spans, setting context, or breadcrumbs
- Wants to integrate Sentry with Next.js, Django, Flask, Express, or other frameworks
- Needs to configure the Sentry CLI for releases or CI/CD
Do NOT trigger this skill for:
- General application logging unrelated to Sentry (use observability skill instead)
- Error handling patterns or try/catch best practices without Sentry context
Setup & authentication
Environment variables
SENTRY_DSN=https://examplePublicKey@o0.ingest.sentry.io/0
SENTRY_AUTH_TOKEN=sntrys_YOUR_TOKEN_HERE
SENTRY_ORG=your-org-slug
SENTRY_PROJECT=your-project-slugInstallation
# JavaScript / Browser
npm install @sentry/browser
# Next.js (recommended: use the wizard)
npx @sentry/wizard@latest -i nextjs
# Python
pip install sentry-sdk
# Node.js
npm install @sentry/node
# Sentry CLI
npm install -g @sentry/cliBasic initialization - JavaScript
import * as Sentry from "@sentry/browser";
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.NODE_ENV,
release: "my-app@1.0.0",
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration(),
],
tracesSampleRate: 1.0,
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
});Basic initialization - Python
import sentry_sdk
sentry_sdk.init(
dsn="your-dsn-here",
environment="production",
traces_sample_rate=1.0,
profile_session_sample_rate=1.0,
send_default_pii=True,
)Core concepts
DSN (Data Source Name) is the unique identifier for your Sentry project. It tells the SDK where to send events. Found in Settings > Projects > Client Keys.
Events vs Issues: An event is a single error occurrence or transaction. Sentry automatically groups similar events into issues using fingerprinting. Your quota is consumed by events, not issues.
Issue states: Issues flow through unresolved -> resolved (or ignored/archived).
Resolved issues that recur become regressed. Archived issues exceeding forecast
volume become escalating.
Traces, transactions, and spans: A trace is a complete request flow across services. A transaction is a top-level span representing a user-facing operation. Spans are the smallest unit of work (DB queries, HTTP calls, file I/O). Distributed tracing connects spans across services via trace propagation headers.
Session Replay: Records DOM state, user interactions, network requests, and console logs as a video-like reproduction. Privacy-first: masks all text and media by default.
Common tasks
Initialize Sentry in Next.js
Use the wizard for automatic setup of client, server, and edge configs:
npx @sentry/wizard@latest -i nextjsThis creates instrumentation-client.ts, instrumentation.ts, sentry.server.config.ts,
sentry.edge.config.ts, and wraps next.config.ts with withSentryConfig:
import { withSentryConfig } from "@sentry/nextjs";
export default withSentryConfig(nextConfig, {
org: "your-org",
project: "your-project",
authToken: process.env.SENTRY_AUTH_TOKEN,
tunnelRoute: "/monitoring",
silent: !process.env.CI,
});Capture errors manually
try {
riskyOperation();
} catch (error) {
Sentry.captureException(error);
}
// Capture a message
Sentry.captureMessage("Something went wrong", "warning");try:
risky_operation()
except Exception as e:
sentry_sdk.capture_exception(e)
sentry_sdk.capture_message("Something went wrong", level="warning")Add custom context and tags
Sentry.setUser({ id: "123", email: "user@example.com" });
Sentry.setTag("feature", "checkout");
Sentry.setContext("order", { id: "order-456", amount: 99.99 });
// Scoped context with withScope
Sentry.withScope((scope) => {
scope.setExtra("debugData", { step: 3 });
Sentry.captureException(new Error("Checkout failed"));
});Create custom spans for performance monitoring
Sentry.startSpan({ name: "processPayment", op: "task" }, async (span) => {
await chargeCustomer();
span.setData("paymentMethod", "card");
});with sentry_sdk.start_span(op="task", name="process_payment"):
charge_customer()Configure Session Replay with privacy controls
Sentry.init({
dsn: "...",
integrations: [
Sentry.replayIntegration({
maskAllText: true,
blockAllMedia: true,
maskAllInputs: true,
}),
],
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
});For high-traffic sites (100k+ sessions/day), use 1% session sample rate and 100% error sample rate.
Upload source maps
# Recommended: use the wizard
npx @sentry/wizard@latest -i sourcemaps
# Manual upload via CLI
sentry-cli sourcemaps upload --release=my-app@1.0.0 ./distSource maps are only generated and uploaded during production builds. Verify artifacts are uploaded before errors occur in production.
Set up breadcrumbs
Sentry.addBreadcrumb({
category: "auth",
message: "User logged in",
level: "info",
data: { userId: "123" },
});Configure sampling for production
Sentry.init({
dsn: "...",
tracesSampleRate: 0.1, // 10% of transactions
// Or use a function for dynamic sampling
tracesSampler: (samplingContext) => {
if (samplingContext.name.includes("/health")) return 0;
if (samplingContext.name.includes("/api/checkout")) return 1.0;
return 0.1;
},
});Gotchas
Sentry.init()must be the very first import - If any other module (logging, HTTP client, database driver) is imported beforeSentry.init()runs, that module's errors and performance data will not be captured. In Node.js, putSentry.init()in a dedicatedinstrument.jsfile that is required before anything else via--require.tracesSampleRate: 1.0in production will exhaust quota fast - 100% tracing on any meaningful traffic volume rapidly burns through your event quota and skews billing. UsetracesSamplerwith a function that returns 0 for health checks and static assets, and lower rates (0.1-0.2) for general traffic.Source maps must be uploaded before the first error - Source map artifacts are matched to errors by release version. If an error is ingested before the source maps for that release are uploaded, the stack trace is permanently unminified in the UI. Upload source maps as part of the deploy pipeline, before traffic is shifted.
Session Replay records sensitive data by default without explicit masking - While
maskAllText: trueis the default, custom components that inject text viainnerHTMLor canvas elements are not automatically masked. Audit replay recordings in a staging environment before enabling in production on pages with PII.withSentryConfigin Next.js wraps and rewritesnext.config.js- If you manually merge config options incorrectly, you can silently disable Sentry's webpack instrumentation. Always use the spread pattern fornextConfigand verify source map upload in CI output after setup.
Error handling
| Error | Cause | Resolution |
|---|---|---|
Invalid DSN |
Malformed or missing DSN string | Verify DSN in Settings > Projects > Client Keys |
Rate limited (429) |
Exceeding project or org event quota | Reduce sample rates or increase quota in billing |
Source maps not applied |
Missing debug IDs or upload timing | Run wizard, verify production build, upload before deploy |
CORS errors on tunnel |
Misconfigured tunnel route | Set tunnelRoute: "/monitoring" in Next.js config |
Events not appearing |
SDK not initialized early enough | Move Sentry.init() to the very first import/line |
References
For detailed content on specific sub-domains, read the relevant file
from the references/ folder:
references/sdk-configuration.md- Complete SDK options for JavaScript and Pythonreferences/nextjs-setup.md- Full Next.js integration guide with all config filesreferences/api-cli.md- Sentry REST API and CLI reference
Only load a references file if the current task requires it - they are long and will consume context.
References
api-cli.md
Sentry API and CLI Reference
REST API
Base URLs
| Region | URL |
|---|---|
| Default | https://sentry.io/api/0/ |
| US | https://us.sentry.io/api/0/ |
| EU (DE) | https://de.sentry.io/api/0/ |
Authentication
# Bearer token (recommended)
curl -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
https://sentry.io/api/0/organizations/
# DSN-based auth (limited to event submission)
curl -H "Authorization: DSN https://public@sentry.io/1" \
https://sentry.io/api/0/...Create auth tokens at: Settings > Auth Tokens (or sentry.io/settings/auth-tokens/).
Key API endpoints
| Category | Endpoint | Description |
|---|---|---|
| Organizations | GET /api/0/organizations/ |
List all organizations |
| Projects | GET /api/0/organizations/{org}/projects/ |
List org projects |
| Issues | GET /api/0/organizations/{org}/issues/ |
List org issues |
| Issue detail | GET /api/0/issues/{issue_id}/ |
Get issue details |
| Resolve issue | PUT /api/0/issues/{issue_id}/ |
Update issue status |
| Events | GET /api/0/issues/{issue_id}/events/ |
List issue events |
| Releases | POST /api/0/organizations/{org}/releases/ |
Create a release |
| Teams | GET /api/0/organizations/{org}/teams/ |
List teams |
| Alerts | GET /api/0/organizations/{org}/alert-rules/ |
List alert rules |
Resolve an issue via API
curl -X PUT \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status": "resolved"}' \
https://sentry.io/api/0/issues/12345/Create a release via API
curl -X POST \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"version": "my-app@1.2.0",
"projects": ["my-project"]
}' \
https://sentry.io/api/0/organizations/my-org/releases/Pagination
API responses use cursor-based pagination via the Link header:
Link: <https://sentry.io/api/0/...?cursor=next_cursor>; rel="next"; results="true"Check results="true" to determine if more pages exist.
Rate limits
The API returns 429 Too Many Requests when rate limited. Check the
Retry-After header for the number of seconds to wait.
Sentry CLI (sentry-cli)
Installation
# npm (recommended for JS projects)
npm install -g @sentry/cli
# Homebrew (macOS)
brew install getsentry/tools/sentry-cli
# curl (Linux/macOS)
curl -sL https://sentry.io/get-cli/ | bash
# Docker
docker pull getsentry/sentry-cliConfiguration
Create a .sentryclirc file at project root or home directory:
[auth]
token=sntrys_YOUR_TOKEN_HERE
[defaults]
org=your-org-slug
project=your-project-slug
url=https://sentry.io/Or use environment variables:
export SENTRY_AUTH_TOKEN=sntrys_YOUR_TOKEN_HERE
export SENTRY_ORG=your-org-slug
export SENTRY_PROJECT=your-project-slugKey commands
Release management
# Create a new release
sentry-cli releases new my-app@1.2.0
# Associate commits with a release
sentry-cli releases set-commits my-app@1.2.0 --auto
# Mark a release as deployed
sentry-cli releases deploys my-app@1.2.0 new -e production
# Finalize a release
sentry-cli releases finalize my-app@1.2.0Source maps
# Upload source maps for a release
sentry-cli sourcemaps upload --release=my-app@1.2.0 ./dist
# Upload with URL prefix for hosted apps
sentry-cli sourcemaps upload --release=my-app@1.2.0 \
--url-prefix="~/static/js" ./build/static/js
# Validate source maps before uploading
sentry-cli sourcemaps explain --release=my-app@1.2.0Debug files (native apps)
# Upload debug symbols (iOS dSYMs, Android debug files)
sentry-cli debug-files upload ./path/to/dsyms
# Check what debug files exist for a project
sentry-cli debug-files checkCron monitoring
# Wrap a cron job for automatic monitoring
sentry-cli monitors run my-cron-slug -- /path/to/script.sh
# Send manual check-ins
sentry-cli monitors check-in my-cron-slug --status=ok
sentry-cli monitors check-in my-cron-slug --status=errorSend test events
# Send a test event to verify setup
sentry-cli send-event -m "Test event from CLI" nextjs-setup.md
Sentry Next.js Integration Guide
Quick setup with wizard
npx @sentry/wizard@latest -i nextjsThe wizard creates all necessary files and prompts for feature selection (Error Monitoring, Logs, Session Replay, Tracing).
Files created by the wizard
instrumentation-client.ts (browser-side)
import * as Sentry from "@sentry/nextjs";
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
sendDefaultPii: true,
tracesSampleRate: process.env.NODE_ENV === "development" ? 1.0 : 0.1,
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
enableLogs: true,
integrations: [Sentry.replayIntegration()],
});instrumentation.ts (server + edge registration)
import * as Sentry from "@sentry/nextjs";
export async function register() {
if (process.env.NEXT_RUNTIME === "nodejs") {
await import("./sentry.server.config");
}
if (process.env.NEXT_RUNTIME === "edge") {
await import("./sentry.edge.config");
}
}
export const onRequestError = Sentry.captureRequestError;sentry.server.config.ts
import * as Sentry from "@sentry/nextjs";
Sentry.init({
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
enableLogs: true,
});sentry.edge.config.ts
import * as Sentry from "@sentry/nextjs";
Sentry.init({
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0,
});next.config.ts wrapper
import type { NextConfig } from "next";
import { withSentryConfig } from "@sentry/nextjs";
const nextConfig: NextConfig = {
// your existing config
};
export default withSentryConfig(nextConfig, {
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
authToken: process.env.SENTRY_AUTH_TOKEN,
// Route browser requests through your server to avoid ad blockers
tunnelRoute: "/monitoring",
// Suppress build output unless in CI
silent: !process.env.CI,
// Automatically upload source maps during build
// Source maps are deleted from the build output after upload
});app/global-error.tsx (React error boundary)
"use client";
import * as Sentry from "@sentry/nextjs";
import { useEffect } from "react";
export default function GlobalError({
error,
reset,
}: {
error: Error & { digest?: string };
reset: () => void;
}) {
useEffect(() => {
Sentry.captureException(error);
}, [error]);
return (
<html>
<body>
<h2>Something went wrong!</h2>
<button onClick={() => reset()}>Try again</button>
</body>
</html>
);
}Environment variables
# Required
NEXT_PUBLIC_SENTRY_DSN=https://examplePublicKey@o0.ingest.sentry.io/0
SENTRY_DSN=https://examplePublicKey@o0.ingest.sentry.io/0
SENTRY_AUTH_TOKEN=sntrys_YOUR_TOKEN_HERE
SENTRY_ORG=your-org-slug
SENTRY_PROJECT=your-project-slug
NEXT_PUBLIC_SENTRY_DSNis needed for client-side,SENTRY_DSNfor server-side.SENTRY_AUTH_TOKENis only needed at build time for source map upload.
Structured logging
import * as Sentry from "@sentry/nextjs";
Sentry.logger.info("User completed checkout", { orderId: "123" });
Sentry.logger.warn("Payment retry attempted", { attempt: 2 });
Sentry.logger.error("Payment failed", { reason: "insufficient_funds" });Key gotchas
- The
tunnelRouteoption routes Sentry requests through your Next.js server, avoiding ad blockers. The default/monitoringpath should not conflict with your app routes. - Source maps are automatically uploaded during
next buildand then deleted from the output. They never reach your production server. - Adjust
tracesSampleRatefor production traffic - development uses 1.0 by default, but production should typically use 0.1 or lower. - The
onRequestErrorexport ininstrumentation.tscaptures server-side rendering errors automatically.
sdk-configuration.md
Sentry SDK Configuration Reference
JavaScript SDK (@sentry/browser, @sentry/node, @sentry/nextjs)
Core options
| Option | Type | Default | Description |
|---|---|---|---|
dsn |
string | required | Data Source Name - where to send events |
environment |
string | production |
Environment tag (production, staging, dev) |
release |
string | auto-detected | App version for release tracking and source maps |
debug |
boolean | false |
Enable verbose SDK logging to console |
enabled |
boolean | true |
Set to false to disable the SDK entirely |
sendDefaultPii |
boolean | false |
Attach request headers and IP addresses |
maxBreadcrumbs |
number | 100 |
Max breadcrumbs to store (0 disables) |
attachStacktrace |
boolean | false |
Attach stack traces to pure message events |
sampleRate |
number | 1.0 |
Error event sample rate (0.0 to 1.0) |
tunnel |
string | none | Proxy URL to bypass ad blockers |
Tracing options
| Option | Type | Default | Description |
|---|---|---|---|
tracesSampleRate |
number | none | Transaction sample rate (0.0 to 1.0) |
tracesSampler |
function | none | Dynamic sampling function, receives samplingContext |
tracePropagationTargets |
array | ["localhost", /^\//] |
URLs for trace header propagation |
Replay options
| Option | Type | Default | Description |
|---|---|---|---|
replaysSessionSampleRate |
number | none | Percentage of all sessions to record |
replaysOnErrorSampleRate |
number | none | Percentage of error sessions to record |
Profiling options
| Option | Type | Default | Description |
|---|---|---|---|
profilesSampleRate |
number | none | Profile sample rate (relative to traces) |
Integrations
import * as Sentry from "@sentry/browser";
Sentry.init({
integrations: [
// Performance tracing - auto-instruments page loads and navigation
Sentry.browserTracingIntegration(),
// Session replay - records DOM state as video-like reproduction
Sentry.replayIntegration({
maskAllText: true,
blockAllMedia: true,
maskAllInputs: true,
}),
// User feedback widget
Sentry.feedbackIntegration({
colorScheme: "system",
}),
],
});Hooks and callbacks
Sentry.init({
// Filter events before sending
beforeSend(event, hint) {
if (event.exception?.values?.[0]?.type === "NetworkError") {
return null; // Drop this event
}
return event;
},
// Filter breadcrumbs
beforeBreadcrumb(breadcrumb, hint) {
if (breadcrumb.category === "console") {
return null; // Drop console breadcrumbs
}
return breadcrumb;
},
// Filter transactions
beforeSendTransaction(event) {
if (event.transaction === "/health") {
return null; // Drop health check transactions
}
return event;
},
});Python SDK (sentry-sdk)
Core options
| Option | Type | Default | Description |
|---|---|---|---|
dsn |
str | required | Data Source Name |
environment |
str | production |
Environment tag |
release |
str | auto-detected | Application version |
debug |
bool | False |
Enable verbose logging |
send_default_pii |
bool | False |
Send PII like user IPs and headers |
max_breadcrumbs |
int | 100 |
Max breadcrumbs stored |
sample_rate |
float | 1.0 |
Error event sample rate (0.0 to 1.0) |
traces_sample_rate |
float | none | Transaction sample rate |
profiles_sample_rate |
float | none | Profile sample rate |
profile_session_sample_rate |
float | none | Continuous profiling rate |
profile_lifecycle |
str | none | Set to "trace" for trace-based profiling |
enable_logs |
bool | False |
Route application logs to Sentry |
Framework auto-detection
The Python SDK auto-detects and integrates with frameworks:
- Django - middleware, template errors, signals
- Flask - request context, error handlers
- FastAPI - ASGI middleware, request tracing
- Celery - task monitoring, error capture
- SQLAlchemy - query spans
- Redis - command spans
- httpx/requests - outgoing HTTP spans
Hooks and callbacks
import sentry_sdk
def before_send(event, hint):
if "exc_info" in hint:
exc_type, exc_value, tb = hint["exc_info"]
if isinstance(exc_value, KeyboardInterrupt):
return None # Drop keyboard interrupts
return event
sentry_sdk.init(
dsn="...",
before_send=before_send,
)Recommended production sample rates
| Traffic level | traces | replays (session) | replays (error) |
|---|---|---|---|
| High (100k+ sessions/day) | 0.01 - 0.05 | 0.01 | 1.0 |
| Medium (10k-100k/day) | 0.1 | 0.1 | 1.0 |
| Low (< 10k/day) | 0.25 - 1.0 | 0.25 | 1.0 |
Always set
replaysOnErrorSampleRate: 1.0in production to capture all error sessions with replay context.
Frequently Asked Questions
What is sentry?
Use this skill when working with Sentry - error monitoring, performance tracing, session replay, cron monitoring, alerts, or source maps. Triggers on any Sentry-related task including SDK initialization, issue triage, custom instrumentation, uploading source maps, configuring alerts, and integrating Sentry into JavaScript, Python, Next.js, or other supported frameworks.
How do I install sentry?
Run npx skills add AbsolutelySkilled/AbsolutelySkilled --skill sentry in your terminal. The skill will be immediately available in your AI coding agent.
What AI agents support sentry?
sentry works with claude-code, gemini-cli, openai-codex, mcp. Install it once and use it across any supported AI coding agent.