honeybadger 5.6.0 → 5.8.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: 0553610b4340f86d2d607666cd3f31da65d5c61c63c8f5956e7d63ff5ef1726d
4
- data.tar.gz: 169eb72ebd67a4fc8bbfd5a462619f7b8f9d875e3ea084a5c39311afa2c40bec
3
+ metadata.gz: 93eae2a3397ecc7b7bc1b86b2a09436cc41e80d6143aa813175aafbc4ef81d64
4
+ data.tar.gz: f2f9025c4fd6f7afc092ba4ce12cf22f0815bea6b0d32e6566f95c52c98be8b9
5
5
  SHA512:
6
- metadata.gz: 1235bc8bf638c498d96e3e440d8fc40ac72f76df0a5ca491d21836367dad636311e6373183f33cc10981c0aca170ecab05ff342a739d7a8d29b5c7db187c5a0b
7
- data.tar.gz: 8ff748c31c80cd90813b8284f5e3f015cb38493713d1f0d921fe43b85791100cb20c32fd3b78f74812e8043b904e1c603a340ef8ac6cd69747d0e81e70af290d
6
+ metadata.gz: ebda94d56e7c4062d3daab6d7ee19828d8a183a7d6caa33a7bef18fcc091bf1cc0b3b60708a50d0da978ec3411d6a27532bb559fb117302312d5c83f5cac4eeb
7
+ data.tar.gz: d693bae2da5c6434df5ce6b0c1ab885f8f89390c0c9849e16a4a0e937685426f18be24947ff52e1f5b8176b9395262315d67b3500e6323e2211c3bc30743d7c4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Change Log
2
2
 
3
+
4
+ ## [5.8.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.7.0...v5.8.0) (2024-03-23)
5
+
6
+
7
+ ### Features
8
+
9
+ * add active_job.attempt_threshold configuration option ([#535](https://github.com/honeybadger-io/honeybadger-ruby/issues/535))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * handle non-string hash keys when sanitizing ([#533](https://github.com/honeybadger-io/honeybadger-ruby/issues/533))
15
+
16
+ ## [5.7.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.6.0...v5.7.0) (2024-03-12)
17
+
18
+
19
+ ### Features
20
+
21
+ * add additional context to ActiveJob notifications ([#528](https://github.com/honeybadger-io/honeybadger-ruby/issues/528)) ([d6ae246](https://github.com/honeybadger-io/honeybadger-ruby/commit/d6ae246a24290d76bcd0c8deb9121707d88976fe))
22
+
3
23
  ## [5.6.0](https://github.com/honeybadger-io/honeybadger-ruby/compare/v5.5.1...v5.6.0) (2024-03-05)
4
24
 
5
25
 
@@ -281,6 +281,11 @@ module Honeybadger
281
281
  default: false,
282
282
  type: Boolean
283
283
  },
284
+ :'active_job.attempt_threshold' => {
285
+ description: 'The number of attempts before notifications will be sent.',
286
+ default: 0,
287
+ type: Integer
288
+ },
284
289
  :'delayed_job.attempt_threshold' => {
285
290
  description: 'The number of attempts before notifications will be sent.',
286
291
  default: 0,
@@ -4,27 +4,46 @@ module Honeybadger
4
4
  # Ignore inline and test adapters, as well as the adapters that we support with their own plugins
5
5
  EXCLUDED_ADAPTERS = %i[inline test delayed_job faktory karafka resque shoryuken sidekiq sucker_punch].freeze
6
6
 
7
- Plugin.register {
8
- requirement { defined?(::Rails.application) && ::Rails.application }
9
- requirement {
10
- ::Rails.application.config.respond_to?(:active_job) &&
7
+ class << self
8
+ def perform_around(job, block)
9
+ Honeybadger.clear!
10
+ context = context(job)
11
+ block.call
12
+ rescue StandardError => e
13
+ Honeybadger.notify(
14
+ e,
15
+ context: context,
16
+ parameters: { arguments: job.arguments }
17
+ ) if job.executions >= Honeybadger.config[:'active_job.attempt_threshold'].to_i
18
+ raise e
19
+ end
20
+
21
+ def context(job) # rubocop:disable Metrics/MethodLength
22
+ {
23
+ component: job.class,
24
+ action: 'perform',
25
+ enqueued_at: job.try(:enqueued_at),
26
+ executions: job.executions,
27
+ job_class: job.class,
28
+ job_id: job.job_id,
29
+ priority: job.priority,
30
+ queue_name: job.queue_name,
31
+ scheduled_at: job.scheduled_at
32
+ }
33
+ end
34
+ end
35
+
36
+ Plugin.register do
37
+ requirement do
38
+ defined?(::Rails.application) &&
39
+ ::Rails.application.config.respond_to?(:active_job) &&
11
40
  !EXCLUDED_ADAPTERS.include?(::Rails.application.config.active_job[:queue_adapter])
12
- }
41
+ end
13
42
 
14
- execution {
15
- ::ActiveJob::Base.class_eval do |base|
16
- base.set_callback :perform, :around do |param, block|
17
- Honeybadger.clear!
18
- begin
19
- block.call
20
- rescue => error
21
- Honeybadger.notify(error, parameters: {job_id: job_id, arguments: arguments})
22
- raise error
23
- end
24
- end
25
- end
26
- }
27
- }
43
+ execution do
44
+ ::ActiveJob::Base.set_callback(:perform, :around, &ActiveJob.method(:perform_around))
45
+ end
46
+ end
28
47
  end
29
48
  end
30
49
  end
@@ -167,7 +167,7 @@ module Honeybadger
167
167
 
168
168
  def filter_key?(key, parents = nil)
169
169
  return false unless filters?
170
- return true if regexps.any? { |r| key =~ r }
170
+ return true if key.respond_to?(:=~) && regexps.any? { |r| key =~ r }
171
171
  return true if deep_regexps && parents && (joined = parents.join(".")) && deep_regexps.any? { |r| joined =~ r }
172
172
  false
173
173
  end
@@ -1,4 +1,4 @@
1
1
  module Honeybadger
2
2
  # The current String Honeybadger version.
3
- VERSION = '5.6.0'.freeze
3
+ VERSION = '5.8.0'.freeze
4
4
  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.6.0
4
+ version: 5.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Honeybadger Industries LLC
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-05 00:00:00.000000000 Z
11
+ date: 2024-03-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Make managing application errors a more pleasant experience.
14
14
  email:
@@ -144,7 +144,7 @@ metadata:
144
144
  documentation_uri: https://docs.honeybadger.io/lib/ruby/
145
145
  homepage_uri: https://www.honeybadger.io/for/ruby/
146
146
  source_code_uri: https://github.com/honeybadger-io/honeybadger-ruby
147
- post_install_message:
147
+ post_install_message:
148
148
  rdoc_options:
149
149
  - "--markup=tomdoc"
150
150
  - "--main=README.md"
@@ -162,8 +162,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
162
  - !ruby/object:Gem::Version
163
163
  version: '0'
164
164
  requirements: []
165
- rubygems_version: 3.4.19
166
- signing_key:
165
+ rubygems_version: 3.5.3
166
+ signing_key:
167
167
  specification_version: 4
168
168
  summary: Error reports you can be happy about.
169
169
  test_files: []