Receber por email
← Voltar para o catálogo

sentry

Central principal de documentação e estrutura de navegação.

185estrelas
Atualizado há 4 meses

Ver no GitHub ↗ Licença: MIT

Como adicionar

/plugin marketplace add AbsolutelySkilled/AbsolutelySkilled

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/sentry-absolutelyskilled/svg)](https://www.skillteca.com.br/skills/sentry-absolutelyskilled)
#ai

Skills relacionadas

Ver todas de Documentos →

Alerta por categoria

Receba novas skills de Documentos toda segunda

1 email curto, só com as skills novas de Documentos. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

When this skill is activated, always start your first response with the 🧢 emoji.

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-slug

Installation

# 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/cli

Basic 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 nextjs

This 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 ./dist
Source 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

  1. Sentry.init() must be the very first import - If any other module (logging, HTTP client, database driver) is imported before Sentry.init() runs, that module's errors and performance data will not be captured. In Node.js, put Sentry.init() in a dedicated instrument.js file that is required before anything else via --require.
  1. tracesSampleRate: 1.0 in production will exhaust quota fast - 100% tracing on any meaningful traffic volume rapidly burns through your event quota and skews billing. Use tracesSampler with a function that returns 0 for health checks and static assets, and lower rates (0.1-0.2) for general traffic.
  1. 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.
  1. Session Replay records sensitive data by default without explicit masking - While maskAllText: true is the default, custom components that inject text via innerHTML or canvas elements are not automatically masked. Audit replay recordings in a staging environment before enabling in production on pages with PII.
  1. withSentryConfig in Next.js wraps and rewrites next.config.js - If you manually merge config options incorrectly, you can silently
Compartilhar X LinkedIn