honeybadger 4.5.6 → 4.6.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: baff304bc3d7912d3643efbc651829441b80b52d7a48d8c2ecb7bc9ab35aac81
4
- data.tar.gz: 3892040a92da339c9f41960c61a2ad30d16597f984f630e595cc2b9fd1c7e31a
3
+ metadata.gz: a0a903cc9a64fe0e5b5bcbfef32b81656217d38316ffc66d368d8cc8982bdc04
4
+ data.tar.gz: fd4ff117b94da660a2039ebc106e7c29430834f3c691c6940cc1bc483dcbc0ac
5
5
  SHA512:
6
- metadata.gz: e29645665a943c5e9055bd0ecd481f289ffb230c113a776311317b6d3ce65f6003bfa0cc7dd2e7461b1ca0b226e36fa73288d27dda124832051b059d090ef7e5
7
- data.tar.gz: 834c71bf1fd0d35512025d73c39485bb95fb513001acec616c342d2a4a42b4c297690415c2a2e4e00098f4d890646bc0427ff4b6f05552d94e44f77de7e6894c
6
+ metadata.gz: e3f58753fa625545ffba12aaa7d9a86e3f8c7c8e3dc6ca1eaa518dd69e1636ef03d4a4b8a71677f34d8816166700102962e94288cb4e82913d1f5c2c0b6564f7
7
+ data.tar.gz: 33459d61b1eae5ab575f65a0ff6b1b7e64a891538b4f5508fe3a45b72fa8c47830a55007858f8aaef97b1c5eaf22a6efdfa3e9147e53eda9a9cde8e854335f7f
@@ -5,6 +5,15 @@ adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.6.0] - 2020-03-12
9
+ ### Fixed
10
+ - Fixed issue where Sidekiq.attempt_threshold was triggering 2 attempts ahead
11
+ of the setting
12
+ - Dup notify opts before mutating (#345)
13
+ ### Changed
14
+ - Breadcrumbs on by default
15
+ - Added Faktory plugin -@scottrobertson
16
+
8
17
  ## [4.5.6] - 2020-01-08
9
18
  ### Fixed
10
19
  - Fix remaining Ruby 2.7 deprecation warnings
@@ -115,6 +115,8 @@ module Honeybadger
115
115
  # @return [String] UUID reference to the notice within Honeybadger.
116
116
  # @return [false] when ignored.
117
117
  def notify(exception_or_opts, opts = {})
118
+ opts = opts.dup
119
+
118
120
  if exception_or_opts.is_a?(Exception)
119
121
  opts[:exception] = exception_or_opts
120
122
  elsif exception_or_opts.respond_to?(:to_hash)
@@ -279,6 +279,11 @@ module Honeybadger
279
279
  default: 0,
280
280
  type: Integer
281
281
  },
282
+ :'faktory.attempt_threshold' => {
283
+ description: 'The number of attempts before notifications will be sent.',
284
+ default: 0,
285
+ type: Integer
286
+ },
282
287
  :'sidekiq.use_component' => {
283
288
  description: 'Automatically set the component to the class of the job. Helps with grouping.',
284
289
  default: true,
@@ -295,8 +300,8 @@ module Honeybadger
295
300
  type: Boolean
296
301
  },
297
302
  :'breadcrumbs.enabled' => {
298
- description: 'Enable/Disable breadcrumb functionality.',
299
- default: false,
303
+ description: 'Disable breadcrumb functionality.',
304
+ default: true,
300
305
  type: Boolean
301
306
  },
302
307
  :'breadcrumbs.active_support_notifications' => {
@@ -0,0 +1,52 @@
1
+ require 'honeybadger/plugin'
2
+ require 'honeybadger/ruby'
3
+
4
+ module Honeybadger
5
+ module Plugins
6
+ module Faktory
7
+ class Middleware
8
+ def call(worker, job)
9
+ Honeybadger.clear!
10
+ yield
11
+ end
12
+ end
13
+
14
+ Plugin.register do
15
+ requirement { defined?(::Faktory) }
16
+
17
+ execution do
18
+ ::Faktory.configure_worker do |faktory|
19
+ faktory.worker_middleware do |chain|
20
+ chain.prepend Middleware
21
+ end
22
+ end
23
+
24
+ ::Faktory.configure_worker do |faktory|
25
+ faktory.error_handlers << lambda do |ex, params|
26
+ opts = {parameters: params}
27
+
28
+ if job = params[:job]
29
+ if (threshold = config[:'faktory.attempt_threshold'].to_i) > 0
30
+ # If job.failure is nil, it is the first attempt. The first
31
+ # retry has a job.failure.retry_count of 0, which would be
32
+ # the second attempt in our case.
33
+ retry_count = job.dig('failure', 'retry_count')
34
+ attempt = retry_count ? retry_count + 1 : 0
35
+
36
+ limit = [job['retry'].to_i, threshold].min
37
+
38
+ return if attempt < limit
39
+ end
40
+
41
+ opts[:component] = job['jobtype']
42
+ opts[:action] = 'perform'
43
+ end
44
+
45
+ Honeybadger.notify(ex, opts)
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -25,20 +25,30 @@ module Honeybadger
25
25
  ::Sidekiq.configure_server do |sidekiq|
26
26
  sidekiq.error_handlers << lambda {|ex, params|
27
27
  job = params[:job] || params
28
- retry_count = job['retry_count'.freeze].to_i
29
- retry_opt = job['retry'.freeze]
30
- max_retries = if retry_opt.is_a?(Integer)
31
- [retry_opt - 1, config[:'sidekiq.attempt_threshold'].to_i].min
32
- else
33
- config[:'sidekiq.attempt_threshold'].to_i
28
+ job_retry = job['retry'.freeze]
29
+
30
+ if (threshold = config[:'sidekiq.attempt_threshold'].to_i) > 0 && job_retry
31
+ # We calculate the job attempts to determine the need to
32
+ # skip. Sidekiq's first job execution will have nil for the
33
+ # 'retry_count' job key. The first retry will have 0 set for
34
+ # the 'retry_count' key, incrementing on each execution
35
+ # afterwards.
36
+ retry_count = job['retry_count'.freeze]
37
+ attempt = retry_count ? retry_count + 1 : 0
38
+
39
+ # Ensure we account for modified max_retries setting
40
+ retry_limit = job_retry == true ? (sidekiq.options[:max_retries] || 25) : job_retry.to_i
41
+ limit = [retry_limit, threshold].min
42
+
43
+ return if attempt < limit
34
44
  end
35
45
 
36
- return if retry_opt && retry_count < max_retries
37
46
  opts = {parameters: params}
38
47
  if config[:'sidekiq.use_component']
39
48
  opts[:component] = job['wrapped'.freeze] || job['class'.freeze]
40
49
  opts[:action] = 'perform' if opts[:component]
41
50
  end
51
+
42
52
  Honeybadger.notify(ex, opts)
43
53
  }
44
54
  end
@@ -1,4 +1,4 @@
1
1
  module Honeybadger
2
2
  # The current String Honeybadger version.
3
- VERSION = '4.5.6'.freeze
3
+ VERSION = '4.6.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: 4.5.6
4
+ version: 4.6.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: 2020-01-08 00:00:00.000000000 Z
11
+ date: 2020-03-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Make managing application errors a more pleasant experience.
14
14
  email:
@@ -65,6 +65,7 @@ files:
65
65
  - lib/honeybadger/plugins/breadcrumbs.rb
66
66
  - lib/honeybadger/plugins/delayed_job.rb
67
67
  - lib/honeybadger/plugins/delayed_job/plugin.rb
68
+ - lib/honeybadger/plugins/faktory.rb
68
69
  - lib/honeybadger/plugins/lambda.rb
69
70
  - lib/honeybadger/plugins/local_variables.rb
70
71
  - lib/honeybadger/plugins/passenger.rb
@@ -152,8 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
153
  - !ruby/object:Gem::Version
153
154
  version: '0'
154
155
  requirements: []
155
- rubyforge_project:
156
- rubygems_version: 2.7.6.2
156
+ rubygems_version: 3.0.1
157
157
  signing_key:
158
158
  specification_version: 4
159
159
  summary: Error reports you can be happy about.