Integration Options for Rails
Learn about configuring integrations.
rails.report_rescued_exceptions
Rails catches exceptions in the ActionDispatch::ShowExceptions or ActionDispatch::DebugExceptions middlewares, depending on the environment. By default, Sentry will report exceptions even when they are rescued by these middlewares.
You can disable this by setting it to false:
config.rails.report_rescued_exceptions = false
config.rails.report_rescued_exceptions = false
rails.skippable_job_adapters
The Active Job integration skips error reporting, tracing, and context propagation for the adapters in this list. When you install sentry-sidekiq, sentry-resque, or sentry-delayed_job, the gem adds its adapter to the list by default, so it reports the Active Job jobs on its backend and Sentry doesn't report them twice.
To skip a custom adapter, add it to the list:
config.rails.skippable_job_adapters << "ActiveJob::QueueAdapters::MyAdapter"
config.rails.skippable_job_adapters << "ActiveJob::QueueAdapters::MyAdapter"
Since version 7.3.0, removing a backend gem's adapter from the list hands its Active Job jobs to sentry-rails:
config.rails.skippable_job_adapters.delete("ActiveJob::QueueAdapters::SidekiqAdapter")
config.rails.skippable_job_adapters.delete("ActiveJob::QueueAdapters::SidekiqAdapter")
Learn what changes in Report Jobs Through the Active Job Integration.
rails.active_job_propagate_traces
Controls whether Sentry connects Active Job execution to the trace that enqueued it. The default is true. Disabling this option still records enqueue spans and job execution transactions, but they won't be connected.
config.rails.active_job_propagate_traces = false
config.rails.active_job_propagate_traces = false
rails.active_job_report_on_retry_error
By default, Sentry reports an Active Job failure after all retry_on attempts are exhausted. Set this option to true to report every failed attempt.
config.rails.active_job_report_on_retry_error = true
config.rails.active_job_report_on_retry_error = true
rails.good_job_exclude_cron_jobs
Available since: v7.3.0
Excludes GoodJob cron entries from monitoring when the :good_job_cron patch is enabled. Defaults to []. Strings and symbols match entry keys exactly; regular expressions match patterns.
config/initializers/sentry.rbSentry.init do |config|
config.enabled_patches << :good_job_cron
config.rails.good_job_exclude_cron_jobs = [:clear_cache, /\Atmp_/]
end
Sentry.init do |config|
config.enabled_patches << :good_job_cron
config.rails.good_job_exclude_cron_jobs = [:clear_cache, /\Atmp_/]
end
See GoodJob cron monitoring for setup.
rails.tracing_subscribers
Tracing subscribers are responsible for capturing tracing spans from Rails instrumentation. The default subscribers are:
Sentry::Rails::Tracing::ActionViewSubscriberSentry::Rails::Tracing::ActiveRecordSubscriberSentry::Rails::Tracing::ActiveStorageSubscriber
# you can add a new subscriber
config.rails.tracing_subscribers << MySubscriber
# or replace the set completely
config.rails.tracing_subscribers = [MySubscriber]
# you can add a new subscriber
config.rails.tracing_subscribers << MySubscriber
# or replace the set completely
config.rails.tracing_subscribers = [MySubscriber]
delayed_job.report_after_job_retries
sentry-delayed_job captures exceptions whenever they occur in a job execution. You can make it wait until the retry is exhausted. Default is false.
config.delayed_job.report_after_job_retries = true
config.delayed_job.report_after_job_retries = true
If you hand Active Job jobs to sentry-rails, this option only applies to the errors sentry-delayed_job still reports for those jobs, such as errors raised before the job starts.
resque.report_after_job_retries
sentry-resque captures exceptions whenever they occur in a job execution. If your jobs use the resque-retry plugin, you can make it wait until the retry limit is reached. Default is false.
config.resque.report_after_job_retries = true
config.resque.report_after_job_retries = true
If you hand Active Job jobs to sentry-rails, this option doesn't apply to those jobs.
sidekiq.report_after_job_retries
sentry-sidekiq captures exceptions whenever they occur in a job execution. You can make it wait until the retry is exhausted. Default is false.
config.sidekiq.report_after_job_retries = true
config.sidekiq.report_after_job_retries = true
sidekiq.report_only_dead_jobs
When enabled, sentry-sidekiq skips error reporting for jobs that set dead: false in their sidekiq_options. Default is false.
config.sidekiq.report_only_dead_jobs = true
config.sidekiq.report_only_dead_jobs = true
attempt_threshold
sentry-sidekiq skips error reporting until a job reaches the given attempt. Set it in the job's sidekiq_options. The threshold is capped at the job's final attempt. Not set by default.
# Report only the last of 5 attempts (1 initial execution + 4 retries)
sidekiq_options retry: 4, attempt_threshold: 5
# Report only the last of 5 attempts (1 initial execution + 4 retries)
sidekiq_options retry: 4, attempt_threshold: 5
If you hand Active Job jobs to sentry-rails, sidekiq.report_after_job_retries, sidekiq.report_only_dead_jobs, and attempt_threshold only apply to the errors sentry-sidekiq still reports for those jobs, such as errors raised before the job starts. Plain Sidekiq jobs aren't affected.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").