sentry-ruby-sdk by getsentry/sentry-for-ai
npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-ruby-sdk一个经过精心设计的向导,它会扫描项目并指导完成完整的 Sentry 设置。
sentry-ruby、sentry-rails 或 Ruby Sentry SDK 时注意: 下面的 SDK API 基于 sentry-ruby v6.4.1。在实施前,请务必对照 docs.sentry.io/platforms/ruby/ 进行验证。
# 现有的 Sentry gems
grep -i sentry Gemfile 2>/dev/null
# 框架
grep -iE '\brails\b|\bsinatra\b' Gemfile 2>/dev/null
# Web 服务器 — Puma 会触发队列时间指导
grep -iE '\bpuma\b' Gemfile 2>/dev/null
# 后台作业
grep -iE '\bsidekiq\b|\bresque\b|\bdelayed_job\b' Gemfile 2>/dev/null
# 竞品监控工具 — 如果发现则触发迁移路径
grep -iE '\bappsignal\b|\bhoneybadger\b|\bbugsnag\b|\brollbar\b|\bairbrake\b' Gemfile 2>/dev/null
# 定时任务 — 触发 Crons 推荐
grep -iE '\bsidekiq-cron\b|\bclockwork\b|\bwhenever\b|\brufus-scheduler\b' Gemfile 2>/dev/null
grep -rn "Sidekiq::Cron\|Clockwork\|every.*do" config/ lib/ --include="*.rb" 2>/dev/null | head -10
# OpenTelemetry 追踪 — 检查 SDK + 仪表化库
grep -iE '\bopentelemetry-sdk\b|\bopentelemetry-instrumentation\b' Gemfile 2>/dev/null
grep -rn "OpenTelemetry::SDK\.configure\|\.use_all\|\.in_span" config/ lib/ app/ --include="*.rb" 2>/dev/null | head -5
# 现有的指标模式 (StatsD, Datadog, Prometheus)
grep -rE "(statsd|dogstatsd|prometheus|\.gauge|\.histogram|\.increment|\.timing)" \
app/ lib/ --include="*.rb" 2>/dev/null | grep -v "_spec\|_test" | head -20
# 配套的前端
cat package.json frontend/package.json web/package.json 2>/dev/null | grep -E '"@sentry|"sentry-'
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
根据发现的内容进行路由:
appsignal, honeybadger, bugsnag, rollbar, airbrake) → 首先加载 ${SKILL_ROOT}/references/migration.md;删除竞品的初始化文件作为迁移的一部分sentry-rails + config/initializers/sentry.rbsentry-ruby + Sentry::Rack::CaptureExceptions 中间件sentry-sidekiq;如果发现现有指标模式,则推荐 MetricsX-Request-Start 头;参见 ${SKILL_ROOT}/references/tracing.md → "请求队列时间"opentelemetry-sdk + 仪表化库,或者源代码中有 OpenTelemetry::SDK.configure) → 使用 OTLP 路径:config.otlp.enabled = true;不要设置 traces_sample_rate;Sentry 会自动将错误链接到 OTel 追踪以具体建议开头 — 不要问开放式问题:
| 功能 | 推荐时机... |
|---|---|
| 错误监控 | 始终 |
| OTLP 集成 | 检测到 OTel 追踪 — 替代原生追踪 |
| 追踪 | Rails / Sinatra / Rack / 任何 HTTP 框架;如果检测到 OTel 追踪则跳过 |
| 日志记录 | 始终 — enable_logs: true 没有额外成本 |
| 指标 | 存在 Sidekiq;检测到现有指标库 (StatsD, Prometheus) |
| 性能剖析 | ⚠️ Beta — 请求性能剖析时;需要 stackprof 或 vernier gem;如果检测到 OTel 追踪则跳过 (需要 traces_sample_rate,与 OTLP 不兼容) |
| 定时任务 | 检测到定时任务 (ActiveJob, Sidekiq-Cron, Clockwork, Whenever) |
检测到 OTel 追踪: "我在项目中看到了 OpenTelemetry 追踪。我推荐 Sentry 的 OTLP 集成用于追踪(通过您现有的 OTel 设置)+ 错误监控 + Sentry 日志记录 [+ 如果适用,加上指标/定时任务]。可以继续吗?"
没有 OTel: "我推荐错误监控 + 追踪 + 日志记录 [+ 如果适用,加上指标]。可以继续吗?"
Rails:
# Gemfile
gem "sentry-ruby"
gem "sentry-rails"
gem "sentry-sidekiq" # 如果使用 Sidekiq
gem "sentry-resque" # 如果使用 Resque
gem "sentry-delayed_job" # 如果使用 DelayedJob
Rack / Sinatra / 纯 Ruby:
gem "sentry-ruby"
运行 bundle install。
| 框架 / 运行时 | Gem | 初始化位置 | 自动仪表化 |
|---|---|---|---|
| Rails | sentry-rails | config/initializers/sentry.rb | 控制器, ActiveRecord, ActiveJob, ActionMailer |
| Rack / Sinatra | sentry-ruby | config.ru 顶部 | 请求 (通过 Sentry::Rack::CaptureExceptions 中间件) |
| Sidekiq | sentry-sidekiq | Sentry 初始化文件或 Sidekiq 配置 | 工作器执行 → 事务 |
| Resque | sentry-resque | Sentry 初始化文件 | 工作器执行 → 事务 |
| DelayedJob | sentry-delayed_job | Sentry 初始化文件 | 任务执行 → 事务 |
config/initializers/sentry.rb)Sentry.init do |config|
config.dsn = ENV["SENTRY_DSN"]
config.spotlight = Rails.env.development? # 本地 Spotlight UI;开发环境不需要 DSN
config.breadcrumbs_logger = [:active_support_logger, :http_logger]
config.send_default_pii = true
config.traces_sample_rate = 1.0 # 生产环境降低到 0.05–0.2
config.enable_logs = true
# 指标默认开启;通过以下方式禁用:config.enable_metrics = false
end
sentry-rails 会自动仪表化 ActionController、ActiveRecord、ActiveJob、ActionMailer。
require "sentry-ruby"
Sentry.init do |config|
config.dsn = ENV["SENTRY_DSN"]
config.spotlight = ENV["RACK_ENV"] == "development"
config.breadcrumbs_logger = [:sentry_logger, :http_logger]
config.send_default_pii = true
config.traces_sample_rate = 1.0
config.enable_logs = true
end
use Sentry::Rack::CaptureExceptions # 在 config.ru 中,位于应用中间件之前
require "sentry-ruby"
require "sentry-sidekiq"
Sentry.init do |config|
config.dsn = ENV["SENTRY_DSN"]
config.spotlight = ENV.fetch("RAILS_ENV", "development") == "development"
config.breadcrumbs_logger = [:sentry_logger]
config.traces_sample_rate = 1.0
config.enable_logs = true
end
SENTRY_DSN=https://xxx@oYYY.ingest.sentry.io/ZZZ
SENTRY_ENVIRONMENT=production # 覆盖 RAILS_ENV / RACK_ENV
SENTRY_RELEASE=my-app@1.0.0
逐一介绍功能。为每个功能加载参考文件,按照其步骤操作,并在继续下一个之前进行验证:
| 功能 | 参考文件 | 加载时机... |
|---|---|---|
| 迁移 | ${SKILL_ROOT}/references/migration.md | 发现竞品 gem 时 — 在安装 Sentry 之前 加载 |
| 错误监控 | ${SKILL_ROOT}/references/error-monitoring.md | 始终 |
| 追踪 | ${SKILL_ROOT}/references/tracing.md | HTTP 处理器 / 分布式追踪 |
| 日志记录 | ${SKILL_ROOT}/references/logging.md | 结构化日志捕获 |
| 指标 | ${SKILL_ROOT}/references/metrics.md | 存在 Sidekiq;检测到现有指标模式 |
| 性能剖析 | ${SKILL_ROOT}/references/profiling.md | 请求性能剖析时 (beta) |
| 定时任务 | ${SKILL_ROOT}/references/crons.md | 检测到或请求定时任务时 |
对于每个功能:读取 ${SKILL_ROOT}/references/<feature>.md,严格按照步骤操作,验证其是否正常工作。
Sentry.init 选项| 选项 | 类型 | 默认值 | 用途 |
|---|---|---|---|
dsn | 字符串 | nil | 如果为空则 SDK 被禁用;环境变量:SENTRY_DSN |
environment | 字符串 | nil | 例如,"production";环境变量:SENTRY_ENVIRONMENT |
release | 字符串 | nil | 例如,"myapp@1.0.0";环境变量:SENTRY_RELEASE |
spotlight | 布尔值 | false | 将事件发送到 Spotlight 侧车(本地开发,不需要 DSN) |
send_default_pii | 布尔值 | false | 包含 IP 地址和请求头 |
sample_rate | 浮点数 | 1.0 | 错误事件采样率 (0.0–1.0) |
traces_sample_rate | 浮点数 | nil | 事务采样率;nil 禁用追踪 |
profiles_sample_rate | 浮点数 | nil | 性能剖析率,相对于 traces_sample_rate;需要 stackprof 或 vernier |
enable_logs | 布尔值 | false | 启用 Sentry 结构化日志 |
enable_metrics | 布尔值 | true | 启用自定义指标(默认开启) |
breadcrumbs_logger | 数组 | [] | 用于自动面包屑的日志记录器(参见日志记录参考) |
max_breadcrumbs | 整数 | 100 | 每个事件的最大面包屑数 |
debug | 布尔值 | false | SDK 详细输出到 stdout |
capture_queue_time | 布尔值 | true | 从 X-Request-Start 头记录请求队列时间 (v6.4.0+, Rails 在 v6.4.1 中修复) |
otlp.enabled | 布尔值 | false | 通过 OTLP 将 OTel span 路由到 Sentry;不要与 traces_sample_rate 结合使用 |
otlp.collector_url | 字符串 | nil | OTel Collector 的 OTLP HTTP 端点 (例如,http://localhost:4318/v1/traces);设置后,span 将发送到收集器而不是直接发送到 Sentry |
org_id | 字符串 | nil | 显式组织 ID;覆盖从 DSN 提取的值;适用于自托管/Relay 设置 (v6.5.0+) |
strict_trace_continuation | 布尔值 | false | 仅当 sentry-org_id baggage 匹配 SDK 的组织 ID 时才继续传入的追踪;防止来自第三方服务的追踪拼接 (v6.5.0+) |
before_send | Lambda | nil | 在发送前修改或丢弃错误事件 |
before_send_transaction | Lambda | nil | 在发送前修改或丢弃事务事件 |
before_send_log | Lambda | nil | 在发送前修改或丢弃日志事件 |
| 变量 | 映射到 | 用途 |
|---|---|---|
SENTRY_DSN | dsn | 数据源名称 |
SENTRY_RELEASE | release | 应用版本 (例如,my-app@1.0.0) |
SENTRY_ENVIRONMENT | environment | 部署环境 |
在 Sentry.init 中设置的选项会覆盖环境变量。
本地开发(不需要 DSN)— Spotlight:
npx @spotlightjs/spotlight # 浏览器 UI 位于 http://localhost:8969
# 或者将事件流式传输到终端:
npx @spotlightjs/spotlight tail traces --format json
config.spotlight = Rails.env.development?(已在上面的初始化块中)会自动将事件路由到本地侧车。
使用真实的 DSN:
Sentry.capture_message("Sentry Ruby SDK 测试")
没有显示任何内容?设置 config.debug = true 并检查 stdout。验证 DSN 格式:https://<key>@o<org>.ingest.sentry.io/<project>。
cat package.json frontend/package.json web/package.json 2>/dev/null | grep -E '"@sentry|"sentry-'
| 检测到前端 | 建议 |
|---|---|
| React / Next.js | sentry-react-sdk |
| Svelte / SvelteKit | sentry-svelte-sdk |
| Vue | @sentry/vue — docs.sentry.io/platforms/javascript/guides/vue/ |
关于 Ruby 后端和 JS 前端之间的追踪拼接,请参见 references/tracing.md → "前端追踪拼接"。
| 问题 | 解决方案 |
|---|---|
| 事件未出现 | config.debug = true;验证 DSN;确保在第一个请求之前调用 Sentry.init |
| Rails 异常缺失 | 必须使用 sentry-rails — 仅使用 sentry-ruby 不会挂钩 Rails 错误处理器 |
| 没有追踪(原生) | 设置 traces_sample_rate > 0;确保使用 sentry-rails 或 Sentry::Rack::CaptureExceptions |
| 没有追踪(OTLP) | 验证 opentelemetry-exporter-otlp gem 已安装;使用 otlp.enabled = true 时不要设置 traces_sample_rate |
| Sidekiq 作业未被追踪 | 添加 sentry-sidekiq gem |
| 缺少请求上下文 | 设置 config.send_default_pii = true |
| 日志未出现 | 设置 config.enable_logs = true;需要 sentry-ruby ≥ 5.27.0 |
| 指标未出现 | 检查 enable_metrics 是否为 false;验证 DSN |
| 关闭时事件丢失 | Process.exit! 会跳过 at_exit 钩子 — 在强制退出前显式调用 Sentry.flush |
| 分叉服务器丢失事件 | Puma/Unicorn 分叉工作进程 — 在 on_worker_boot 或 after_fork 中重新初始化;如果没有这个,后台工作线程会在子进程中死亡 |
| DSN 被拒绝 / 事件未送达 | 验证 DSN 格式:https://<key>@o<org>.ingest.sentry.io/<project>;设置 config.debug = true 以查看传输错误 |
每周安装数
152
仓库
GitHub 星标
82
首次出现
2026年3月1日
安全审计
安装在
codex150
gemini-cli150
github-copilot150
cursor150
kimi-cli149
amp149
All Skills > SDK Setup > Ruby SDK
Opinionated wizard that scans the project and guides through complete Sentry setup.
sentry-ruby, sentry-rails, or the Ruby Sentry SDKNote: SDK APIs below reflect sentry-ruby v6.4.1. Always verify against docs.sentry.io/platforms/ruby/ before implementing.
# Existing Sentry gems
grep -i sentry Gemfile 2>/dev/null
# Framework
grep -iE '\brails\b|\bsinatra\b' Gemfile 2>/dev/null
# Web server — Puma triggers queue time guidance
grep -iE '\bpuma\b' Gemfile 2>/dev/null
# Background jobs
grep -iE '\bsidekiq\b|\bresque\b|\bdelayed_job\b' Gemfile 2>/dev/null
# Competitor monitoring tools — triggers migration path if found
grep -iE '\bappsignal\b|\bhoneybadger\b|\bbugsnag\b|\brollbar\b|\bairbrake\b' Gemfile 2>/dev/null
# Scheduled jobs — triggers Crons recommendation
grep -iE '\bsidekiq-cron\b|\bclockwork\b|\bwhenever\b|\brufus-scheduler\b' Gemfile 2>/dev/null
grep -rn "Sidekiq::Cron\|Clockwork\|every.*do" config/ lib/ --include="*.rb" 2>/dev/null | head -10
# OpenTelemetry tracing — check for SDK + instrumentations
grep -iE '\bopentelemetry-sdk\b|\bopentelemetry-instrumentation\b' Gemfile 2>/dev/null
grep -rn "OpenTelemetry::SDK\.configure\|\.use_all\|\.in_span" config/ lib/ app/ --include="*.rb" 2>/dev/null | head -5
# Existing metric patterns (StatsD, Datadog, Prometheus)
grep -rE "(statsd|dogstatsd|prometheus|\.gauge|\.histogram|\.increment|\.timing)" \
app/ lib/ --include="*.rb" 2>/dev/null | grep -v "_spec\|_test" | head -20
# Companion frontend
cat package.json frontend/package.json web/package.json 2>/dev/null | grep -E '"@sentry|"sentry-'
Route from what you find:
appsignal, honeybadger, bugsnag, rollbar, airbrake) → load ${SKILL_ROOT}/references/migration.md first; delete the competitor initializer as part of migrationsentry-rails + config/initializers/sentry.rbsentry-ruby + middlewareLead with a concrete proposal — don't ask open-ended questions:
| Feature | Recommend when... |
|---|---|
| Error Monitoring | Always |
| OTLP Integration | OTel tracing detected — replaces native Tracing |
| Tracing | Rails / Sinatra / Rack / any HTTP framework; skip if OTel tracing detected |
| Logging | Always — enable_logs: true costs nothing |
| Metrics | Sidekiq present; existing metric lib (StatsD, Prometheus) detected |
| Profiling | ⚠️ Beta — performance profiling requested; requires stackprof or vernier gem; skip if OTel tracing detected (requires traces_sample_rate, incompatible with OTLP) |
OTel tracing detected: "I see OpenTelemetry tracing in the project. I recommend Sentry's OTLP integration for tracing (via your existing OTel setup) + Error Monitoring + Sentry Logging [+ Metrics/Crons if applicable]. Shall I proceed?"
No OTel: "I recommend Error Monitoring + Tracing + Logging [+ Metrics if applicable]. Shall I proceed?"
Rails:
# Gemfile
gem "sentry-ruby"
gem "sentry-rails"
gem "sentry-sidekiq" # if using Sidekiq
gem "sentry-resque" # if using Resque
gem "sentry-delayed_job" # if using DelayedJob
Rack / Sinatra / plain Ruby:
gem "sentry-ruby"
Run bundle install.
| Framework / Runtime | Gem | Init location | Auto-instruments |
|---|---|---|---|
| Rails | sentry-rails | config/initializers/sentry.rb | Controllers, ActiveRecord, ActiveJob, ActionMailer |
| Rack / Sinatra | sentry-ruby | Top of config.ru | Requests (via Sentry::Rack::CaptureExceptions middleware) |
| Sidekiq | sentry-sidekiq |
config/initializers/sentry.rb)Sentry.init do |config|
config.dsn = ENV["SENTRY_DSN"]
config.spotlight = Rails.env.development? # local Spotlight UI; no DSN needed in dev
config.breadcrumbs_logger = [:active_support_logger, :http_logger]
config.send_default_pii = true
config.traces_sample_rate = 1.0 # lower to 0.05–0.2 in production
config.enable_logs = true
# Metrics on by default; disable with: config.enable_metrics = false
end
sentry-rails auto-instruments ActionController, ActiveRecord, ActiveJob, ActionMailer.
require "sentry-ruby"
Sentry.init do |config|
config.dsn = ENV["SENTRY_DSN"]
config.spotlight = ENV["RACK_ENV"] == "development"
config.breadcrumbs_logger = [:sentry_logger, :http_logger]
config.send_default_pii = true
config.traces_sample_rate = 1.0
config.enable_logs = true
end
use Sentry::Rack::CaptureExceptions # in config.ru, before app middleware
require "sentry-ruby"
require "sentry-sidekiq"
Sentry.init do |config|
config.dsn = ENV["SENTRY_DSN"]
config.spotlight = ENV.fetch("RAILS_ENV", "development") == "development"
config.breadcrumbs_logger = [:sentry_logger]
config.traces_sample_rate = 1.0
config.enable_logs = true
end
SENTRY_DSN=https://xxx@oYYY.ingest.sentry.io/ZZZ
SENTRY_ENVIRONMENT=production # overrides RAILS_ENV / RACK_ENV
SENTRY_RELEASE=my-app@1.0.0
Walk through features one at a time. Load the reference file for each, follow its steps, and verify before moving to the next:
| Feature | Reference file | Load when... |
|---|---|---|
| Migration | ${SKILL_ROOT}/references/migration.md | Competitor gem found — load before installing Sentry |
| Error Monitoring | ${SKILL_ROOT}/references/error-monitoring.md | Always |
| Tracing | ${SKILL_ROOT}/references/tracing.md | HTTP handlers / distributed tracing |
| Logging | ${SKILL_ROOT}/references/logging.md | Structured log capture |
| Metrics |
For each feature: Read ${SKILL_ROOT}/references/<feature>.md, follow steps exactly, verify it works.
Sentry.init Options| Option | Type | Default | Purpose |
|---|---|---|---|
dsn | String | nil | SDK disabled if empty; env: SENTRY_DSN |
environment | String | nil | e.g., "production"; env: SENTRY_ENVIRONMENT |
| Variable | Maps to | Purpose |
|---|---|---|
SENTRY_DSN | dsn | Data Source Name |
SENTRY_RELEASE | release | App version (e.g., my-app@1.0.0) |
SENTRY_ENVIRONMENT | environment | Deployment environment |
Options set in Sentry.init override environment variables.
Local dev (no DSN needed) — Spotlight:
npx @spotlightjs/spotlight # browser UI at http://localhost:8969
# or stream events to terminal:
npx @spotlightjs/spotlight tail traces --format json
config.spotlight = Rails.env.development? (already in the init block above) routes events to the local sidecar automatically.
With a real DSN:
Sentry.capture_message("Sentry Ruby SDK test")
Nothing appears? Set config.debug = true and check stdout. Verify DSN format: https://<key>@o<org>.ingest.sentry.io/<project>.
cat package.json frontend/package.json web/package.json 2>/dev/null | grep -E '"@sentry|"sentry-'
| Frontend detected | Suggest |
|---|---|
| React / Next.js | sentry-react-sdk |
| Svelte / SvelteKit | sentry-svelte-sdk |
| Vue | @sentry/vue — docs.sentry.io/platforms/javascript/guides/vue/ |
For trace stitching between Ruby backend and JS frontend, see references/tracing.md → "Frontend trace stitching".
| Issue | Solution |
|---|---|
| Events not appearing | config.debug = true; verify DSN; ensure Sentry.init before first request |
| Rails exceptions missing | Must use sentry-rails — sentry-ruby alone doesn't hook Rails error handlers |
| No traces (native) | Set traces_sample_rate > 0; ensure sentry-rails or Sentry::Rack::CaptureExceptions |
| No traces (OTLP) |
Weekly Installs
152
Repository
GitHub Stars
82
First Seen
Mar 1, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex150
gemini-cli150
github-copilot150
cursor150
kimi-cli149
amp149
Electron应用自动化指南:使用agent-browser通过CDP实现桌面应用自动化
13,500 周安装
Sentry::Rack::CaptureExceptionssentry-sidekiq; recommend Metrics if existing metric patterns foundX-Request-Start header; see ${SKILL_ROOT}/references/tracing.md → "Request Queue Time"opentelemetry-sdk + instrumentations in Gemfile, or OpenTelemetry::SDK.configure in source) → use OTLP path: config.otlp.enabled = true; do not set traces_sample_rate; Sentry links errors to OTel traces automatically| Crons | Scheduled jobs detected (ActiveJob, Sidekiq-Cron, Clockwork, Whenever) |
| Sentry initializer or Sidekiq config |
| Worker execution → transactions |
| Resque | sentry-resque | Sentry initializer | Worker execution → transactions |
| DelayedJob | sentry-delayed_job | Sentry initializer | Job execution → transactions |
${SKILL_ROOT}/references/metrics.md| Sidekiq present; existing metric patterns |
| Profiling | ${SKILL_ROOT}/references/profiling.md | Performance profiling requested (beta) |
| Crons | ${SKILL_ROOT}/references/crons.md | Scheduled jobs detected or requested |
release | String | nil | e.g., "myapp@1.0.0"; env: SENTRY_RELEASE |
spotlight | Boolean | false | Send events to Spotlight sidecar (local dev, no DSN needed) |
send_default_pii | Boolean | false | Include IP addresses and request headers |
sample_rate | Float | 1.0 | Error event sample rate (0.0–1.0) |
traces_sample_rate | Float | nil | Transaction sample rate; nil disables tracing |
profiles_sample_rate | Float | nil | Profiling rate relative to traces_sample_rate; requires stackprof or vernier |
enable_logs | Boolean | false | Enable Sentry structured Logs |
enable_metrics | Boolean | true | Enable custom metrics (on by default) |
breadcrumbs_logger | Array | [] | Loggers for automatic breadcrumbs (see logging reference) |
max_breadcrumbs | Integer | 100 | Max breadcrumbs per event |
debug | Boolean | false | Verbose SDK output to stdout |
capture_queue_time | Boolean | true | Record request queue time from X-Request-Start header (v6.4.0+, Rails fixed in v6.4.1) |
otlp.enabled | Boolean | false | Route OTel spans to Sentry via OTLP; do not combine with traces_sample_rate |
otlp.collector_url | String | nil | OTLP HTTP endpoint of an OTel Collector (e.g., http://localhost:4318/v1/traces); when set, spans are sent to the collector instead of directly to Sentry |
org_id | String | nil | Explicit org ID; overrides DSN-extracted value; useful for self-hosted/Relay setups (v6.5.0+) |
strict_trace_continuation | Boolean | false | Only continue incoming traces when sentry-org_id baggage matches SDK's org ID; prevents trace stitching from third-party services (v6.5.0+) |
before_send | Lambda | nil | Mutate or drop error events before sending |
before_send_transaction | Lambda | nil | Mutate or drop transaction events before sending |
before_send_log | Lambda | nil | Mutate or drop log events before sending |
Verify opentelemetry-exporter-otlp gem is installed; do not set traces_sample_rate when using otlp.enabled = true |
| Sidekiq jobs not traced | Add sentry-sidekiq gem |
| Missing request context | Set config.send_default_pii = true |
| Logs not appearing | Set config.enable_logs = true; sentry-ruby ≥ 5.27.0 required |
| Metrics not appearing | Check enable_metrics is not false; verify DSN |
| Events lost on shutdown | Process.exit! skips at_exit hooks — call Sentry.flush explicitly before forced exits |
| Forking server loses events | Puma/Unicorn fork workers — re-initialize in on_worker_boot or after_fork; without this, the background worker thread dies in child processes |
| DSN rejected / events not delivered | Verify DSN format: https://<key>@o<org>.ingest.sentry.io/<project>; set config.debug = true to see transport errors |