Skip to content

Commit

Permalink
flatten configuration to rails.actibve_job_report_after_job_retries
Browse files Browse the repository at this point in the history
  • Loading branch information
modosc committed Dec 18, 2024
1 parent 373101e commit a803cf8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 28 deletions.
5 changes: 2 additions & 3 deletions sentry-rails/lib/sentry/rails/active_job.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require "sentry/rails/active_job/configuration"
module Sentry
module Rails
module ActiveJobExtensions
Expand Down Expand Up @@ -47,7 +46,7 @@ def record(job, &block)
rescue Exception => e # rubocop:disable Lint/RescueException
finish_sentry_transaction(transaction, 500)

unless Sentry.configuration.active_job.report_after_job_retries
unless Sentry.configuration.rails.active_job_report_after_job_retries
capture_exception(job, e)
end

Expand Down Expand Up @@ -75,7 +74,7 @@ def register_retry_stopped_subscriber

def retry_stopped_handler(*args)
return if !Sentry.initialized? || already_supported_by_sentry_integration?
return unless Sentry.configuration.active_job.report_after_job_retries
return unless Sentry.configuration.rails.active_job_report_after_job_retries
event = ActiveSupport::Notifications::Event.new(*args)
job = event.payload[:job]
error = event.payload[:error]
Expand Down
25 changes: 0 additions & 25 deletions sentry-rails/lib/sentry/rails/active_job/configuration.rb

This file was deleted.

4 changes: 4 additions & 0 deletions sentry-rails/lib/sentry/rails/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ class Configuration
# @return [Hash<String, Array<Symbol>>]
attr_accessor :active_support_logger_subscription_items

# Set this option to true if you want Sentry to only capture the last job
# retry if it fails.
attr_accessor :active_job_report_after_job_retries

def initialize
@register_error_subscriber = false
@report_rescued_exceptions = true
Expand Down

0 comments on commit a803cf8

Please sign in to comment.