honeybadger 5.23.0 → 5.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CHANGELOG.md +7 -0
 - data/lib/honeybadger/agent.rb +5 -0
 - data/lib/honeybadger/init/hanami.rb +1 -1
 - data/lib/honeybadger/init/rails.rb +5 -3
 - data/lib/honeybadger/plugins/active_job.rb +1 -1
 - data/lib/honeybadger/plugins/delayed_job.rb +1 -0
 - data/lib/honeybadger/plugins/faktory.rb +1 -0
 - data/lib/honeybadger/plugins/karafka.rb +5 -3
 - data/lib/honeybadger/plugins/rails.rb +1 -1
 - data/lib/honeybadger/plugins/resque.rb +1 -0
 - data/lib/honeybadger/plugins/shoryuken.rb +1 -0
 - data/lib/honeybadger/plugins/sidekiq.rb +43 -41
 - data/lib/honeybadger/plugins/sucker_punch.rb +1 -0
 - data/lib/honeybadger/plugins/thor.rb +1 -0
 - data/lib/honeybadger/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 31e329380be3a169c776198960e6557ca9868511737c1b272e9720dbe6f2740e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 33347a45c58cd403e12cc3d93194163b6ee2ba310f54c04d5a9423221e4bc6f7
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 6c3b9297748ae34ff9bba398ae209de3917afa0d2f50569a697695702cac972e9212d13ea4d766be5eb90c257df8e3a0aac2688e200da2ea2c2f72f27809ac07
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 3f2a284a89f3a4ead20ac8dc75d537a0985dbe4aea60528571d528c3e54e4bf0e5e9f0bf57d8176ad926a794fa56a4e9a7c9663aa9291fec0d6cf1d4d902a75e
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,6 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Change Log
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         | 
| 
      
 4 
     | 
    
         
            +
            ## [5.24.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.23.0...v5.24.0) (2024-11-21)
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ### Features
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            * skip middleware, plugins, and exception reporting when exceptions are disabled ([#646](https://github.com/honeybadger-io/honeybadger-ruby/issues/646)) ([6c4d7d5](https://github.com/honeybadger-io/honeybadger-ruby/commit/6c4d7d53f7356717894269b5fc9095621c9e8014))
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
       4 
11 
     | 
    
         
             
            ## [5.23.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.22.0...v5.23.0) (2024-11-19)
         
     | 
| 
       5 
12 
     | 
    
         | 
| 
       6 
13 
     | 
    
         | 
    
        data/lib/honeybadger/agent.rb
    CHANGED
    
    | 
         @@ -125,6 +125,11 @@ module Honeybadger 
     | 
|
| 
       125 
125 
     | 
    
         
             
                # @return [String] UUID reference to the notice within Honeybadger.
         
     | 
| 
       126 
126 
     | 
    
         
             
                # @return [false] when ignored.
         
     | 
| 
       127 
127 
     | 
    
         
             
                def notify(exception_or_opts = nil, opts = {}, **kwargs)
         
     | 
| 
      
 128 
     | 
    
         
            +
                  if !config[:'exceptions.enabled']
         
     | 
| 
      
 129 
     | 
    
         
            +
                    debug { 'disabled feature=notices' }
         
     | 
| 
      
 130 
     | 
    
         
            +
                    return false
         
     | 
| 
      
 131 
     | 
    
         
            +
                  end
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
       128 
133 
     | 
    
         
             
                  opts = opts.dup
         
     | 
| 
       129 
134 
     | 
    
         
             
                  opts.merge!(kwargs)
         
     | 
| 
       130 
135 
     | 
    
         | 
| 
         @@ -8,7 +8,7 @@ Honeybadger.init!({ 
     | 
|
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
            Honeybadger.load_plugins!
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
            if Hanami::VERSION >= '2.0'
         
     | 
| 
      
 11 
     | 
    
         
            +
            if Hanami::VERSION >= '2.0' && Honeybadger.config[:'exceptions.enabled']
         
     | 
| 
       12 
12 
     | 
    
         
             
              Hanami.app.instance_eval do
         
     | 
| 
       13 
13 
     | 
    
         
             
                config.middleware.use Honeybadger::Rack::UserFeedback
         
     | 
| 
       14 
14 
     | 
    
         
             
                config.middleware.use Honeybadger::Rack::UserInformer
         
     | 
| 
         @@ -14,9 +14,11 @@ module Honeybadger 
     | 
|
| 
       14 
14 
     | 
    
         
             
                    initializer 'honeybadger.install_middleware' do |app|
         
     | 
| 
       15 
15 
     | 
    
         
             
                      honeybadger_config = Honeybadger::Agent.instance.config
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
                       
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 17 
     | 
    
         
            +
                      if honeybadger_config[:'exceptions.enabled']
         
     | 
| 
      
 18 
     | 
    
         
            +
                        app.config.middleware.insert(0, Honeybadger::Rack::ErrorNotifier)
         
     | 
| 
      
 19 
     | 
    
         
            +
                        app.config.middleware.insert_before(Honeybadger::Rack::ErrorNotifier, Honeybadger::Rack::UserInformer) if honeybadger_config[:'user_informer.enabled']
         
     | 
| 
      
 20 
     | 
    
         
            +
                        app.config.middleware.insert_before(Honeybadger::Rack::ErrorNotifier, Honeybadger::Rack::UserFeedback) if honeybadger_config[:'feedback.enabled']
         
     | 
| 
      
 21 
     | 
    
         
            +
                      end
         
     | 
| 
       20 
22 
     | 
    
         
             
                    end
         
     | 
| 
       21 
23 
     | 
    
         | 
| 
       22 
24 
     | 
    
         
             
                    config.before_initialize do
         
     | 
| 
         @@ -51,7 +51,7 @@ module Honeybadger 
     | 
|
| 
       51 
51 
     | 
    
         
             
                    end
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
53 
     | 
    
         
             
                    execution do
         
     | 
| 
       54 
     | 
    
         
            -
                      ::ActiveJob::Base.set_callback(:perform, :around, &ActiveJob.method(:perform_around))
         
     | 
| 
      
 54 
     | 
    
         
            +
                      ::ActiveJob::Base.set_callback(:perform, :around, &ActiveJob.method(:perform_around)) if Honeybadger.config[:'exceptions.enabled']
         
     | 
| 
       55 
55 
     | 
    
         | 
| 
       56 
56 
     | 
    
         
             
                      if config.load_plugin_insights?(:active_job)
         
     | 
| 
       57 
57 
     | 
    
         
             
                        ::ActiveSupport::Notifications.subscribe(/(enqueue_at|enqueue|enqueue_retry|enqueue_all|perform|retry_stopped|discard)\.active_job/, Honeybadger::ActiveJobSubscriber.new)
         
     | 
| 
         @@ -8,9 +8,11 @@ module Honeybadger 
     | 
|
| 
       8 
8 
     | 
    
         
             
                  execution do
         
     | 
| 
       9 
9 
     | 
    
         
             
                    require 'honeybadger/karafka'
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                     
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 11 
     | 
    
         
            +
                    if Honeybadger.config[:'exceptions.enabled']
         
     | 
| 
      
 12 
     | 
    
         
            +
                      errors_listener = ::Honeybadger::Karafka::ErrorsListener.new
         
     | 
| 
      
 13 
     | 
    
         
            +
                      ::Karafka.monitor.subscribe(errors_listener)
         
     | 
| 
      
 14 
     | 
    
         
            +
                      ::Karafka.producer.monitor.subscribe(errors_listener) if ::Karafka.respond_to?(:producer)
         
     | 
| 
      
 15 
     | 
    
         
            +
                    end
         
     | 
| 
       14 
16 
     | 
    
         | 
| 
       15 
17 
     | 
    
         
             
                    if config.load_plugin_insights?(:karafka)
         
     | 
| 
       16 
18 
     | 
    
         
             
                      ::Karafka.monitor.subscribe(::Honeybadger::Karafka::InsightsListener.new)
         
     | 
| 
         @@ -64,7 +64,7 @@ module Honeybadger 
     | 
|
| 
       64 
64 
     | 
    
         
             
                        ::ActionDispatch::ShowExceptions.prepend(ExceptionsCatcher)
         
     | 
| 
       65 
65 
     | 
    
         
             
                      end
         
     | 
| 
       66 
66 
     | 
    
         | 
| 
       67 
     | 
    
         
            -
                      if defined?(::ActiveSupport::ErrorReporter) # Rails 7
         
     | 
| 
      
 67 
     | 
    
         
            +
                      if Honeybadger.config[:'exceptions.enabled'] && defined?(::ActiveSupport::ErrorReporter) # Rails 7
         
     | 
| 
       68 
68 
     | 
    
         
             
                        ::Rails.error.subscribe(ErrorSubscriber)
         
     | 
| 
       69 
69 
     | 
    
         
             
                      end
         
     | 
| 
       70 
70 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -73,60 +73,62 @@ module Honeybadger 
     | 
|
| 
       73 
73 
     | 
    
         
             
                    requirement { defined?(::Sidekiq) }
         
     | 
| 
       74 
74 
     | 
    
         | 
| 
       75 
75 
     | 
    
         
             
                    execution do
         
     | 
| 
       76 
     | 
    
         
            -
                       
     | 
| 
       77 
     | 
    
         
            -
                         
     | 
| 
       78 
     | 
    
         
            -
                           
     | 
| 
      
 76 
     | 
    
         
            +
                      if Honeybadger.config[:'exceptions.enabled']
         
     | 
| 
      
 77 
     | 
    
         
            +
                        ::Sidekiq.configure_server do |sidekiq|
         
     | 
| 
      
 78 
     | 
    
         
            +
                          sidekiq.server_middleware do |chain|
         
     | 
| 
      
 79 
     | 
    
         
            +
                            chain.prepend Middleware
         
     | 
| 
      
 80 
     | 
    
         
            +
                          end
         
     | 
| 
       79 
81 
     | 
    
         
             
                        end
         
     | 
| 
       80 
     | 
    
         
            -
                      end
         
     | 
| 
       81 
82 
     | 
    
         | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
      
 83 
     | 
    
         
            +
                        if defined?(::Sidekiq::VERSION) && ::Sidekiq::VERSION > '3'
         
     | 
| 
      
 84 
     | 
    
         
            +
                          ::Sidekiq.configure_server do |sidekiq|
         
     | 
| 
       84 
85 
     | 
    
         | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
      
 86 
     | 
    
         
            +
                            sidekiq_default_configuration = (::Sidekiq::VERSION > '7') ?
         
     | 
| 
      
 87 
     | 
    
         
            +
                              ::Sidekiq.default_configuration : Class.new
         
     | 
| 
       87 
88 
     | 
    
         | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
      
 89 
     | 
    
         
            +
                            sidekiq.error_handlers << lambda { |ex, sidekiq_params, sidekiq_config = sidekiq_default_configuration|
         
     | 
| 
      
 90 
     | 
    
         
            +
                              params = sidekiq_params.dup
         
     | 
| 
      
 91 
     | 
    
         
            +
                              if defined?(::Sidekiq::Config)
         
     | 
| 
      
 92 
     | 
    
         
            +
                                if params[:_config].is_a?(::Sidekiq::Config) # Sidekiq > 6 and < 7.1.5
         
     | 
| 
      
 93 
     | 
    
         
            +
                                  params[:_config] = params[:_config].instance_variable_get(:@options)
         
     | 
| 
      
 94 
     | 
    
         
            +
                                else # Sidekiq >= 7.1.5
         
     | 
| 
      
 95 
     | 
    
         
            +
                                  params[:_config] = sidekiq_config.instance_variable_get(:@options)
         
     | 
| 
      
 96 
     | 
    
         
            +
                                end
         
     | 
| 
       95 
97 
     | 
    
         
             
                              end
         
     | 
| 
       96 
     | 
    
         
            -
                            end
         
     | 
| 
       97 
98 
     | 
    
         | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
      
 99 
     | 
    
         
            +
                              job = params[:job] || params
         
     | 
| 
       99 
100 
     | 
    
         | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
      
 101 
     | 
    
         
            +
                              job_retry = job['retry'.freeze]
         
     | 
| 
       101 
102 
     | 
    
         | 
| 
       102 
     | 
    
         
            -
             
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
       106 
     | 
    
         
            -
             
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
      
 103 
     | 
    
         
            +
                              if (threshold = config[:'sidekiq.attempt_threshold'].to_i) > 0 && job_retry
         
     | 
| 
      
 104 
     | 
    
         
            +
                                # We calculate the job attempts to determine the need to
         
     | 
| 
      
 105 
     | 
    
         
            +
                                # skip. Sidekiq's first job execution will have nil for the
         
     | 
| 
      
 106 
     | 
    
         
            +
                                # 'retry_count' job key. The first retry will have 0 set for
         
     | 
| 
      
 107 
     | 
    
         
            +
                                # the 'retry_count' key, incrementing on each execution
         
     | 
| 
      
 108 
     | 
    
         
            +
                                # afterwards.
         
     | 
| 
      
 109 
     | 
    
         
            +
                                retry_count = job['retry_count'.freeze]
         
     | 
| 
      
 110 
     | 
    
         
            +
                                attempt = retry_count ? retry_count + 1 : 0
         
     | 
| 
       110 
111 
     | 
    
         | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
      
 112 
     | 
    
         
            +
                                max_retries = (::Sidekiq::VERSION > '7') ?
         
     | 
| 
      
 113 
     | 
    
         
            +
                                  ::Sidekiq.default_configuration[:max_retries] : sidekiq.options[:max_retries]
         
     | 
| 
      
 114 
     | 
    
         
            +
                                # Ensure we account for modified max_retries setting
         
     | 
| 
      
 115 
     | 
    
         
            +
                                default_max_retry_attempts = defined?(::Sidekiq::JobRetry::DEFAULT_MAX_RETRY_ATTEMPTS) ? ::Sidekiq::JobRetry::DEFAULT_MAX_RETRY_ATTEMPTS : 25
         
     | 
| 
      
 116 
     | 
    
         
            +
                                retry_limit = job_retry == true ? (max_retries || default_max_retry_attempts) : job_retry.to_i
         
     | 
| 
       116 
117 
     | 
    
         | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
      
 118 
     | 
    
         
            +
                                limit = [retry_limit, threshold].min
         
     | 
| 
       118 
119 
     | 
    
         | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
      
 120 
     | 
    
         
            +
                                return if attempt < limit
         
     | 
| 
      
 121 
     | 
    
         
            +
                              end
         
     | 
| 
       121 
122 
     | 
    
         | 
| 
       122 
     | 
    
         
            -
             
     | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
       125 
     | 
    
         
            -
             
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
      
 123 
     | 
    
         
            +
                              opts = { parameters: params }
         
     | 
| 
      
 124 
     | 
    
         
            +
                              if config[:'sidekiq.use_component']
         
     | 
| 
      
 125 
     | 
    
         
            +
                                opts[:component] = job['wrapped'.freeze] || job['class'.freeze]
         
     | 
| 
      
 126 
     | 
    
         
            +
                                opts[:action] = 'perform' if opts[:component]
         
     | 
| 
      
 127 
     | 
    
         
            +
                              end
         
     | 
| 
       127 
128 
     | 
    
         | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
      
 129 
     | 
    
         
            +
                              Honeybadger.notify(ex, opts)
         
     | 
| 
      
 130 
     | 
    
         
            +
                            }
         
     | 
| 
      
 131 
     | 
    
         
            +
                          end
         
     | 
| 
       130 
132 
     | 
    
         
             
                        end
         
     | 
| 
       131 
133 
     | 
    
         
             
                      end
         
     | 
| 
       132 
134 
     | 
    
         | 
| 
         @@ -6,6 +6,7 @@ module Honeybadger 
     | 
|
| 
       6 
6 
     | 
    
         
             
                requirement { defined?(::SuckerPunch) }
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                execution do
         
     | 
| 
      
 9 
     | 
    
         
            +
                  return unless Honeybadger.config[:'exceptions.enabled']
         
     | 
| 
       9 
10 
     | 
    
         
             
                  if SuckerPunch.respond_to?(:exception_handler=) # >= v2
         
     | 
| 
       10 
11 
     | 
    
         
             
                    SuckerPunch.exception_handler = ->(ex, klass, args) { Honeybadger.notify(ex, { :component => klass, :parameters => args }) }
         
     | 
| 
       11 
12 
     | 
    
         
             
                  else
         
     | 
    
        data/lib/honeybadger/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: honeybadger
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 5. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 5.24.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Honeybadger Industries LLC
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2024-11- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-11-21 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: logger
         
     |