AgentSkillsCN

sentry

Sentry——一款用于错误追踪、性能监控、会话回放、性能剖析与告警的应用监控平台。在使用Sentry构建应用,或询问其SDK初始化、错误捕获、链路追踪、源映射、采样、PII脱敏、隧道传输,或与Next.js、Node.js或其他JavaScript框架的集成时使用。获取最新版的实时文档,以了解最新详情。

SKILL.md
--- frontmatter
name: sentry
description: "Sentry — application monitoring platform for error tracking, performance monitoring, session replay, profiling, and alerting. Use when building with Sentry or asking about SDK initialization, error capture, tracing, source maps, sampling, PII scrubbing, tunneling, or integration with Next.js, Node.js, or other JavaScript frameworks. Fetch live documentation for up-to-date details."

Sentry

Sentry is an application monitoring platform for real-time error tracking, performance monitoring, session replay, profiling, cron monitoring, and log aggregation.

Documentation

Key Capabilities

Sentry's SDK bundles capabilities developers often add as separate tools:

  • Performance tracing: distributed tracing across services is built-in — configure tracesSampleRate and tracePropagationTargets, no external APM needed
  • Session Replay: full session recording with Sentry.replayIntegration() — no third-party replay tool needed
  • Profiling: function-level performance profiling with Sentry.browserProfilingIntegration() — no separate profiler needed
  • User Feedback: collect user-submitted reports tied to errors with Sentry.feedbackIntegration() — no separate feedback widget needed
  • Cron monitoring: track scheduled job health with check-ins — no external uptime monitor needed for crons

Best Practices

  • Lower tracesSampleRate in production — the getting-started default of 1.0 captures 100% of transactions. At any meaningful traffic volume this inflates costs fast. Use a low value (0.1 or less) and consider tracesSampler for dynamic sampling by route.
  • Session Replay uses a two-rate pattern — set replaysSessionSampleRate low (e.g. 0.1) for normal sessions and replaysOnErrorSampleRate: 1.0 so every error session is always captured. Agents often set only one rate and miss error context or over-capture.
  • Source maps require CI auth token — the wizard writes .env.sentry-build-plugin (auto-gitignored) for local builds, but CI/CD pipelines need SENTRY_AUTH_TOKEN set as an environment variable separately. Missing this silently produces minified stack traces in production.
  • Next.js requires four files — The client runtime uses instrumentation-client.ts. Server and edge configs (sentry.server.config.ts, sentry.edge.config.ts) must be imported from instrumentation.ts via conditional imports — without instrumentation.ts, the server and edge configs do nothing. Missing any one file leaves a runtime blind spot without obvious errors.
  • Use tunnel to bypass ad blockers — set tunnel: "/tunnel" in Sentry.init() and add a backend route that proxies to Sentry's ingest endpoint. Without this, a significant portion of browser errors are silently dropped by ad blockers and privacy extensions.