honeybadger 5.23.0 → 5.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -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 +4 -2
- 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: b68a6aaaacbd4d0dacf73e81dac6927cc89bd1446b91be6d5a51456f3c7b7723
|
4
|
+
data.tar.gz: c8d46e503b7a562a63b01776f8b14aa98dccd5d81fc7ea02b98bd2ccff23ec7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bff878d0ea80ad0fc34f9265e7815dc2c9bf922e4f5bb59381a4822b549725fdcce413206c0f48495e56bb283ccdf3f23d4a485541b51fd843563d83f397103
|
7
|
+
data.tar.gz: 2bf7ff80ed9af1137ba412b51d29e0ae5dc7151f103c2a804dc3edf86f27e756f69c307d1d79d7f084f82c643b76b9049587873a06bfa722a041d425251ba8f6
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
3
|
|
4
|
+
## [5.25.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.24.0...v5.25.0) (2024-11-26)
|
5
|
+
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* set context during rails error report ([#649](https://github.com/honeybadger-io/honeybadger-ruby/issues/649)) ([dee37e1](https://github.com/honeybadger-io/honeybadger-ruby/commit/dee37e157b0913e24a5d368e3d2cbe733f87214e))
|
10
|
+
|
11
|
+
## [5.24.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.23.0...v5.24.0) (2024-11-21)
|
12
|
+
|
13
|
+
|
14
|
+
### Features
|
15
|
+
|
16
|
+
* 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))
|
17
|
+
|
4
18
|
## [5.23.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.22.0...v5.23.0) (2024-11-19)
|
5
19
|
|
6
20
|
|
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)
|
@@ -32,6 +32,8 @@ module Honeybadger
|
|
32
32
|
|
33
33
|
class ErrorSubscriber
|
34
34
|
def self.report(exception, handled:, severity:, context: {}, source: nil)
|
35
|
+
Honeybadger.context(context)
|
36
|
+
|
35
37
|
# We only report handled errors (`Rails.error.handle`)
|
36
38
|
# Unhandled errors will be caught by our integrations (eg middleware),
|
37
39
|
# which have richer context than the Rails error reporter
|
@@ -41,7 +43,7 @@ module Honeybadger
|
|
41
43
|
|
42
44
|
tags = ["severity:#{severity}", "handled:#{handled}"]
|
43
45
|
tags << "source:#{source}" if source
|
44
|
-
Honeybadger.notify(exception,
|
46
|
+
Honeybadger.notify(exception, tags: tags)
|
45
47
|
end
|
46
48
|
|
47
49
|
def self.source_ignored?(source)
|
@@ -64,7 +66,7 @@ module Honeybadger
|
|
64
66
|
::ActionDispatch::ShowExceptions.prepend(ExceptionsCatcher)
|
65
67
|
end
|
66
68
|
|
67
|
-
if defined?(::ActiveSupport::ErrorReporter) # Rails 7
|
69
|
+
if Honeybadger.config[:'exceptions.enabled'] && defined?(::ActiveSupport::ErrorReporter) # Rails 7
|
68
70
|
::Rails.error.subscribe(ErrorSubscriber)
|
69
71
|
end
|
70
72
|
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.25.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-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logger
|