airbrake 11.0.2 → 11.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b3ded27d61e498357607b8b562b2254a9b11c11b6580161f3ded2557acd85e7
4
- data.tar.gz: 9f6b460076c28a77312487505a5f8aa0aa98ac3ff46e6a14c5cc0796e5f8f906
3
+ metadata.gz: bd22c4ba5f388c063021267c805f9f72f9905c8e0f7a2b7e19d0f6a45c9718a9
4
+ data.tar.gz: b919ee2bdae1a073c939b752d9827f3d8ecd6c30f18739019f9becbf6974a605
5
5
  SHA512:
6
- metadata.gz: e416c056868b6143ea2132a05fbd588d42b044604956678eb1d2b22a510d54274ab35d165abab5903696e19e01c1901c60971660d78e37fc43d3185d933014a0
7
- data.tar.gz: 9209af921bc3c68e57ca6d032c8aa837e3be5684ec236b3d8f113a8707cabb12075db9214f621b5e4a95341d9a390d8d99f337e92cc223b46def34b71e34553e
6
+ metadata.gz: 2362a03c41aebeddaf2e6bcd2272760ea0fb94b88a0dcabb644ab5c9b3a72ed72281f05f314f04491e27d99fae9c5353bbfaa4fc1d43f09d3e2316f6edfb02ba
7
+ data.tar.gz: f260895a27e6f8e2368c2be1431344291d5dcdf731f0d4b71d4ab2f14de1265cb93759c888ad03592b02dabaa7944e9c4dfbfed4fb87b443e3aaddeba0321760
@@ -10,26 +10,28 @@ require 'airbrake/rails/action_cable/notify_callback'
10
10
  end
11
11
  end
12
12
 
13
- module ActionCable
14
- module Channel
15
- # @since v8.3.0
16
- # @api private
17
- # @see https://github.com/rails/rails/blob/master/actioncable/lib/action_cable/channel/base.rb
18
- class Base
19
- alias perform_action_without_airbrake perform_action
13
+ module Airbrake
14
+ module ActionCable
15
+ module Channel
16
+ # @since v8.3.0
17
+ # @api private
18
+ # @see https://github.com/rails/rails/blob/master/actioncable/lib/action_cable/channel/base.rb
19
+ module Base
20
+ def perform_action(*args, &block)
21
+ super(*args, &block)
22
+ rescue Exception => ex # rubocop:disable Lint/RescueException
23
+ Airbrake.notify(ex) do |notice|
24
+ notice.stash[:action_cable_connection] = connection
25
+ notice[:context][:component] = self.class
26
+ notice[:context][:action] = args.first['action']
27
+ notice[:params].merge!(args.first)
28
+ end
20
29
 
21
- def perform_action(*args, &block)
22
- perform_action_without_airbrake(*args, &block)
23
- rescue Exception => ex # rubocop:disable Lint/RescueException
24
- Airbrake.notify(ex) do |notice|
25
- notice.stash[:action_cable_connection] = connection
26
- notice[:context][:component] = self.class
27
- notice[:context][:action] = args.first['action']
28
- notice[:params].merge!(args.first)
30
+ raise ex
29
31
  end
30
-
31
- raise ex
32
32
  end
33
33
  end
34
34
  end
35
35
  end
36
+
37
+ ActionCable::Channel::Base.prepend(Airbrake::ActionCable::Channel::Base)
data/lib/airbrake/rake.rb CHANGED
@@ -5,61 +5,62 @@
5
5
  # See: https://goo.gl/ksn6PE
6
6
  Rake::TaskManager.record_task_metadata = true
7
7
 
8
- module Rake
9
- # Redefine +Rake::Task#execute+, so it can report errors to Airbrake.
10
- class Task
11
- # Store the original method to use it later.
12
- alias execute_without_airbrake execute
13
-
14
- # A wrapper around the original +#execute+, that catches all errors and
15
- # notifies Airbrake.
16
- #
17
- # rubocop:disable Lint/RescueException
18
- def execute(args = nil)
19
- execute_without_airbrake(args)
20
- rescue Exception => ex
21
- notify_airbrake(ex, args)
22
- raise ex
23
- end
24
- # rubocop:enable Lint/RescueException
8
+ module Airbrake
9
+ module Rake
10
+ # Redefine +Rake::Task#execute+, so it can report errors to Airbrake.
11
+ module Task
12
+ # A wrapper around the original +#execute+, that catches all errors and
13
+ # notifies Airbrake.
14
+ #
15
+ # rubocop:disable Lint/RescueException
16
+ def execute(args = nil)
17
+ super(args)
18
+ rescue Exception => ex
19
+ notify_airbrake(ex, args)
20
+ raise ex
21
+ end
22
+ # rubocop:enable Lint/RescueException
25
23
 
26
- private
24
+ private
27
25
 
28
- def notify_airbrake(exception, args)
29
- notice = Airbrake.build_notice(exception)
30
- notice[:context][:component] = 'rake'
31
- notice[:context][:action] = name
32
- notice[:params].merge!(
33
- rake_task: task_info,
34
- execute_args: args,
35
- argv: ARGV.join(' '),
36
- )
26
+ def notify_airbrake(exception, args)
27
+ notice = Airbrake.build_notice(exception)
28
+ notice[:context][:component] = 'rake'
29
+ notice[:context][:action] = name
30
+ notice[:params].merge!(
31
+ rake_task: task_info,
32
+ execute_args: args,
33
+ argv: ARGV.join(' '),
34
+ )
37
35
 
38
- Airbrake.notify_sync(notice)
39
- end
36
+ Airbrake.notify_sync(notice)
37
+ end
40
38
 
41
- # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize
42
- def task_info
43
- info = {}
39
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize
40
+ def task_info
41
+ info = {}
44
42
 
45
- info[:name] = name
46
- info[:timestamp] = timestamp.to_s
47
- info[:investigation] = investigation
43
+ info[:name] = name
44
+ info[:timestamp] = timestamp.to_s
45
+ info[:investigation] = investigation
48
46
 
49
- info[:full_comment] = full_comment if full_comment
50
- info[:arg_names] = arg_names if arg_names.any?
51
- info[:arg_description] = arg_description if arg_description
52
- info[:locations] = locations if locations.any?
53
- info[:sources] = sources if sources.any?
47
+ info[:full_comment] = full_comment if full_comment
48
+ info[:arg_names] = arg_names if arg_names.any?
49
+ info[:arg_description] = arg_description if arg_description
50
+ info[:locations] = locations if locations.any?
51
+ info[:sources] = sources if sources.any?
54
52
 
55
- if prerequisite_tasks.any?
56
- info[:prerequisite_tasks] = prerequisite_tasks.map do |p|
57
- p.__send__(:task_info)
53
+ if prerequisite_tasks.any?
54
+ info[:prerequisite_tasks] = prerequisite_tasks.map do |p|
55
+ p.__send__(:task_info)
56
+ end
58
57
  end
59
- end
60
58
 
61
- info
59
+ info
60
+ end
61
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize
62
62
  end
63
- # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize
64
63
  end
65
64
  end
65
+
66
+ Rake::Task.prepend(Airbrake::Rake::Task)
@@ -30,32 +30,33 @@ module Resque
30
30
  end
31
31
  end
32
32
 
33
- module Resque
34
- # Measures elapsed time of a job and notifies Airbrake of the execution
35
- # status.
36
- #
37
- # @since v9.6.0
38
- class Job
39
- # Store the original method to use it later.
40
- alias perform_without_airbrake perform
41
-
42
- def perform
43
- timing = Airbrake::Benchmark.measure do
44
- perform_without_airbrake
33
+ module Airbrake
34
+ module Resque
35
+ # Measures elapsed time of a job and notifies Airbrake of the execution
36
+ # status.
37
+ #
38
+ # @since v9.6.0
39
+ module Job
40
+ def perform
41
+ timing = Airbrake::Benchmark.measure do
42
+ super
43
+ end
44
+ rescue StandardError => exception
45
+ Airbrake.notify_queue_sync(
46
+ queue: payload['class'],
47
+ error_count: 1,
48
+ timing: 0.01,
49
+ )
50
+ raise exception
51
+ else
52
+ Airbrake.notify_queue_sync(
53
+ queue: payload['class'],
54
+ error_count: 0,
55
+ timing: timing,
56
+ )
45
57
  end
46
- rescue StandardError => exception
47
- Airbrake.notify_queue_sync(
48
- queue: payload['class'],
49
- error_count: 1,
50
- timing: 0.01,
51
- )
52
- raise exception
53
- else
54
- Airbrake.notify_queue_sync(
55
- queue: payload['class'],
56
- error_count: 0,
57
- timing: timing,
58
- )
59
58
  end
60
59
  end
61
60
  end
61
+
62
+ Resque::Job.prepend(Airbrake::Resque::Job)
@@ -39,34 +39,36 @@ end
39
39
 
40
40
  Sneakers.error_reporters << Airbrake::Sneakers::ErrorReporter.new
41
41
 
42
- module Sneakers
43
- # @todo Migrate to Sneakers v2.12.0 middleware API when it's released
44
- # @see https://github.com/jondot/sneakers/pull/364
45
- module Worker
46
- # Sneakers v2.7.0+ renamed `do_work` to `process_work`.
47
- if method_defined?(:process_work)
48
- alias process_work_without_airbrake process_work
49
- else
50
- alias process_work_without_airbrake do_work
51
- end
52
-
53
- def process_work(delivery_info, metadata, msg, handler)
54
- timing = Airbrake::Benchmark.measure do
55
- process_work_without_airbrake(delivery_info, metadata, msg, handler)
42
+ module Airbrake
43
+ module Sneakers
44
+ # @todo Migrate to Sneakers v2.12.0 middleware API when it's released
45
+ # @see https://github.com/jondot/sneakers/pull/364
46
+ module Worker
47
+ # Sneakers v2.7.0+ renamed `do_work` to `process_work`.
48
+ define_method(
49
+ ::Sneakers::Worker.method_defined?(:process_work) ? :process_work : :do_work,
50
+ ) do |delivery_info, metadata, msg, handler|
51
+ begin
52
+ timing = Airbrake::Benchmark.measure do
53
+ super(delivery_info, metadata, msg, handler)
54
+ end
55
+ rescue Exception => exception # rubocop:disable Lint/RescueException
56
+ Airbrake.notify_queue(
57
+ queue: self.class.to_s,
58
+ error_count: 1,
59
+ timing: 0.01,
60
+ )
61
+ raise exception
62
+ else
63
+ Airbrake.notify_queue(
64
+ queue: self.class.to_s,
65
+ error_count: 0,
66
+ timing: timing,
67
+ )
68
+ end
56
69
  end
57
- rescue Exception => exception # rubocop:disable Lint/RescueException
58
- Airbrake.notify_queue(
59
- queue: self.class.to_s,
60
- error_count: 1,
61
- timing: 0.01,
62
- )
63
- raise exception
64
- else
65
- Airbrake.notify_queue(
66
- queue: self.class.to_s,
67
- error_count: 0,
68
- timing: timing,
69
- )
70
70
  end
71
71
  end
72
72
  end
73
+
74
+ Sneakers::Worker.prepend(Airbrake::Sneakers::Worker)
@@ -3,5 +3,5 @@
3
3
  # We use Semantic Versioning v2.0.0
4
4
  # More information: http://semver.org/
5
5
  module Airbrake
6
- AIRBRAKE_VERSION = '11.0.2'
6
+ AIRBRAKE_VERSION = '11.0.3'
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake
3
3
  version: !ruby/object:Gem::Version
4
- version: 11.0.2
4
+ version: 11.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airbrake Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-12 00:00:00.000000000 Z
11
+ date: 2021-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: airbrake-ruby