honeybadger 5.22.0 → 5.24.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40136d87c293fee9689b5f11926a15bc98c225f34f6a7b75e4fcd8ede1cacc5f
4
- data.tar.gz: '028f8549e380de8c248013f0ed7846f5fea5018f71c8ac1e0bc310a72d695fdd'
3
+ metadata.gz: 31e329380be3a169c776198960e6557ca9868511737c1b272e9720dbe6f2740e
4
+ data.tar.gz: 33347a45c58cd403e12cc3d93194163b6ee2ba310f54c04d5a9423221e4bc6f7
5
5
  SHA512:
6
- metadata.gz: 1404e62cbc7b74d49e3a3881791c5cada2ab820e447efb0c7d2c83994cd81d54b32ca614b52a9fc47606d368c65c950ab5159e7e9342e7214c9d891a132d12e6
7
- data.tar.gz: 737dc2abee3fef27ecd93034e6914eb0a6439a6fdcb35e803ceeb2bb74161f0dd19b08fc1661ea78723b7ecd6a8b984c8a1f2733288c63d446ca1c68fa3b335f
6
+ metadata.gz: 6c3b9297748ae34ff9bba398ae209de3917afa0d2f50569a697695702cac972e9212d13ea4d766be5eb90c257df8e3a0aac2688e200da2ea2c2f72f27809ac07
7
+ data.tar.gz: 3f2a284a89f3a4ead20ac8dc75d537a0985dbe4aea60528571d528c3e54e4bf0e5e9f0bf57d8176ad926a794fa56a4e9a7c9663aa9291fec0d6cf1d4d902a75e
data/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
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
+
11
+ ## [5.23.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.22.0...v5.23.0) (2024-11-19)
12
+
13
+
14
+ ### Features
15
+
16
+ * update puma and autotuner plugins ([#644](https://github.com/honeybadger-io/honeybadger-ruby/issues/644)) ([1ed9687](https://github.com/honeybadger-io/honeybadger-ruby/commit/1ed96874c31c0273bc28cb917043f19140fd8204))
17
+
4
18
  ## [5.22.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.21.0...v5.22.0) (2024-11-14)
5
19
 
6
20
 
@@ -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
 
@@ -491,6 +491,31 @@ module Honeybadger
491
491
  description: "Number of seconds between registry flushes.",
492
492
  default: 60,
493
493
  type: Integer
494
+ },
495
+ :'puma.insights.events' => {
496
+ description: 'Enable automatic event capturing for Puma stats.',
497
+ default: true,
498
+ type: Boolean
499
+ },
500
+ :'puma.insights.metrics' => {
501
+ description: 'Enable automatic metric data aggregation for Puma stats.',
502
+ default: false,
503
+ type: Boolean
504
+ },
505
+ :'puma.insights.collection_interval' => {
506
+ description: 'The frequency in which the Honeybadger gem will collect Puma stats.',
507
+ default: 1,
508
+ type: Integer
509
+ },
510
+ :'autotuner.insights.events' => {
511
+ description: 'Enable automatic event capturing for Autotuner stats.',
512
+ default: true,
513
+ type: Boolean
514
+ },
515
+ :'autotuner.insights.metrics' => {
516
+ description: 'Enable automatic metric data aggregation for Autotuner stats.',
517
+ default: false,
518
+ type: Boolean
494
519
  }
495
520
  }.freeze
496
521
 
@@ -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
- app.config.middleware.insert(0, Honeybadger::Rack::ErrorNotifier)
18
- app.config.middleware.insert_before(Honeybadger::Rack::ErrorNotifier, Honeybadger::Rack::UserInformer) if honeybadger_config[:'user_informer.enabled']
19
- app.config.middleware.insert_before(Honeybadger::Rack::ErrorNotifier, Honeybadger::Rack::UserFeedback) if honeybadger_config[:'feedback.enabled']
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)
@@ -10,17 +10,20 @@ module Honeybadger
10
10
  execution do
11
11
  singleton_class.include(Honeybadger::InstrumentationHelper)
12
12
 
13
- ::Autotuner.enabled = true
14
-
15
13
  ::Autotuner.reporter = proc do |report|
16
14
  Honeybadger.event("report.autotuner", report: report.to_s)
17
15
  end
18
16
 
19
- metric_source 'autotuner'
20
-
21
17
  ::Autotuner.metrics_reporter = proc do |metrics|
22
- metrics.each do |key, val|
23
- gauge key, ->{ val }
18
+ if config.load_plugin_insights_events?(:autotuner)
19
+ Honeybadger.event('stats.autotuner', metrics)
20
+ end
21
+
22
+ if config.load_plugin_insights_metrics?(:autotuner)
23
+ metric_source 'autotuner'
24
+ metrics.each do |key, val|
25
+ gauge key, ->{ val }
26
+ end
24
27
  end
25
28
  end
26
29
  end
@@ -15,6 +15,7 @@ module Honeybadger
15
15
  end
16
16
 
17
17
  execution do
18
+ return unless Honeybadger.config[:'exceptions.enabled']
18
19
  require 'honeybadger/plugins/delayed_job/plugin'
19
20
  ::Delayed::Worker.plugins << Plugins::DelayedJob::Plugin
20
21
  end
@@ -15,6 +15,7 @@ module Honeybadger
15
15
  requirement { defined?(::Faktory) }
16
16
 
17
17
  execution do
18
+ return unless Honeybadger.config[:'exceptions.enabled']
18
19
  ::Faktory.configure_worker do |faktory|
19
20
  faktory.worker_middleware do |chain|
20
21
  chain.prepend Middleware
@@ -8,9 +8,11 @@ module Honeybadger
8
8
  execution do
9
9
  require 'honeybadger/karafka'
10
10
 
11
- errors_listener = ::Honeybadger::Karafka::ErrorsListener.new
12
- ::Karafka.monitor.subscribe(errors_listener)
13
- ::Karafka.producer.monitor.subscribe(errors_listener) if ::Karafka.respond_to?(:producer)
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
@@ -64,6 +64,7 @@ module Honeybadger
64
64
  end
65
65
 
66
66
  execution do
67
+ return unless Honeybadger.config[:'exceptions.enabled']
67
68
  ::Resque::Job.send(:include, Installer)
68
69
  end
69
70
  end
@@ -40,6 +40,7 @@ module Honeybadger
40
40
  requirement { defined?(::Shoryuken) }
41
41
 
42
42
  execution do
43
+ return unless Honeybadger.config[:'exceptions.enabled']
43
44
  ::Shoryuken.configure_server do |config|
44
45
  config.server_middleware do |chain|
45
46
  chain.add Middleware
@@ -73,60 +73,62 @@ module Honeybadger
73
73
  requirement { defined?(::Sidekiq) }
74
74
 
75
75
  execution do
76
- ::Sidekiq.configure_server do |sidekiq|
77
- sidekiq.server_middleware do |chain|
78
- chain.prepend Middleware
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
- if defined?(::Sidekiq::VERSION) && ::Sidekiq::VERSION > '3'
83
- ::Sidekiq.configure_server do |sidekiq|
83
+ if defined?(::Sidekiq::VERSION) && ::Sidekiq::VERSION > '3'
84
+ ::Sidekiq.configure_server do |sidekiq|
84
85
 
85
- sidekiq_default_configuration = (::Sidekiq::VERSION > '7') ?
86
- ::Sidekiq.default_configuration : Class.new
86
+ sidekiq_default_configuration = (::Sidekiq::VERSION > '7') ?
87
+ ::Sidekiq.default_configuration : Class.new
87
88
 
88
- sidekiq.error_handlers << lambda { |ex, sidekiq_params, sidekiq_config = sidekiq_default_configuration|
89
- params = sidekiq_params.dup
90
- if defined?(::Sidekiq::Config)
91
- if params[:_config].is_a?(::Sidekiq::Config) # Sidekiq > 6 and < 7.1.5
92
- params[:_config] = params[:_config].instance_variable_get(:@options)
93
- else # Sidekiq >= 7.1.5
94
- params[:_config] = sidekiq_config.instance_variable_get(:@options)
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
- job = params[:job] || params
99
+ job = params[:job] || params
99
100
 
100
- job_retry = job['retry'.freeze]
101
+ job_retry = job['retry'.freeze]
101
102
 
102
- if (threshold = config[:'sidekiq.attempt_threshold'].to_i) > 0 && job_retry
103
- # We calculate the job attempts to determine the need to
104
- # skip. Sidekiq's first job execution will have nil for the
105
- # 'retry_count' job key. The first retry will have 0 set for
106
- # the 'retry_count' key, incrementing on each execution
107
- # afterwards.
108
- retry_count = job['retry_count'.freeze]
109
- attempt = retry_count ? retry_count + 1 : 0
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
- max_retries = (::Sidekiq::VERSION > '7') ?
112
- ::Sidekiq.default_configuration[:max_retries] : sidekiq.options[:max_retries]
113
- # Ensure we account for modified max_retries setting
114
- default_max_retry_attempts = defined?(::Sidekiq::JobRetry::DEFAULT_MAX_RETRY_ATTEMPTS) ? ::Sidekiq::JobRetry::DEFAULT_MAX_RETRY_ATTEMPTS : 25
115
- retry_limit = job_retry == true ? (max_retries || default_max_retry_attempts) : job_retry.to_i
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
- limit = [retry_limit, threshold].min
118
+ limit = [retry_limit, threshold].min
118
119
 
119
- return if attempt < limit
120
- end
120
+ return if attempt < limit
121
+ end
121
122
 
122
- opts = { parameters: params }
123
- if config[:'sidekiq.use_component']
124
- opts[:component] = job['wrapped'.freeze] || job['class'.freeze]
125
- opts[:action] = 'perform' if opts[:component]
126
- end
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
- Honeybadger.notify(ex, opts)
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
@@ -25,6 +25,7 @@ module Honeybadger
25
25
  requirement { defined?(::Thor.no_commands) }
26
26
 
27
27
  execution do
28
+ return unless Honeybadger.config[:'exceptions.enabled']
28
29
  ::Thor.send(:include, Thor)
29
30
  end
30
31
  end
@@ -1,4 +1,4 @@
1
1
  module Honeybadger
2
2
  # The current String Honeybadger version.
3
- VERSION = '5.22.0'.freeze
3
+ VERSION = '5.24.0'.freeze
4
4
  end
@@ -12,7 +12,7 @@ module Honeybadger
12
12
  in_background do
13
13
  loop do
14
14
  puma_plugin.record
15
- sleep 1
15
+ sleep [::Honeybadger.config.collection_interval(:puma).to_i, 1].max
16
16
  end
17
17
  end
18
18
  end
@@ -35,8 +35,14 @@ module Honeybadger
35
35
  end
36
36
 
37
37
  def record_puma_stats(stats, context={})
38
- STATS_KEYS.each do |stat|
39
- gauge stat, context, ->{ stats[stat] } if stats[stat]
38
+ if Honeybadger.config.load_plugin_insights_events?(:puma)
39
+ Honeybadger.event('stats.puma', context.merge(stats))
40
+ end
41
+
42
+ if Honeybadger.config.load_plugin_insights_metrics?(:puma)
43
+ STATS_KEYS.each do |stat|
44
+ gauge stat, context, ->{ stats[stat] } if stats[stat]
45
+ end
40
46
  end
41
47
  end
42
48
  end
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.22.0
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-14 00:00:00.000000000 Z
11
+ date: 2024-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logger