airbrake 10.0.1 → 10.0.6

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: f6ebb0d64b92742b80afe65583bf19f6c3fc7352d146e95765b8c5b7d2d1949b
4
- data.tar.gz: 2e02317eeb64c7f4ece9173b88af2033c13d630dc9072232d39a697495da3f19
3
+ metadata.gz: a8c1a47736f8dd93e0023e7ac0ce9d8e5e852baaba52bd725203577c3881d058
4
+ data.tar.gz: d0f623664683c44ca43cf29b067fe72ed4c7b7920e9390f0346ca1cc3b8ae409
5
5
  SHA512:
6
- metadata.gz: b69a9609edd060362d33626f715696ce41a49f05a796ad314f7cb7258d3e7b03274ebeb7ef8c4c17fc004f64cdd56f3af51ba5c59f62acaeb2416ee7517d3af2
7
- data.tar.gz: 99b1645d2b95c0d73d2bad8a2bc04960334e14e8d0d13f613d30f7666f250b05d5e0567944113302e8c6a6dc40a17fc8e897d6fc578af41af96426f07b79efc3
6
+ metadata.gz: 22c50e2be09ff46299ec304ef79fb28f69a4017170b5c67f8abf9633a891e8b51d7a197d6d7568b1cfe2ee11a2a2b916f12f88896d0488fb3ae37c999b277a36
7
+ data.tar.gz: 59747af59ca1ec23c3cd1ba31ec3e42daa922ce85bb49e1306a4b13d3b75fc8ab41365607dd7558277f301db6aaee8865862749003ce6e65aa1598fca10914bd
@@ -28,7 +28,7 @@ module Delayed
28
28
  notice[:context][:action] = action
29
29
  end
30
30
 
31
- ::Airbrake.notify_queue_sync(
31
+ ::Airbrake.notify_queue(
32
32
  queue: action,
33
33
  error_count: 1,
34
34
  timing: 0.01,
@@ -36,7 +36,7 @@ module Delayed
36
36
 
37
37
  raise exception
38
38
  else
39
- ::Airbrake.notify_queue_sync(
39
+ ::Airbrake.notify_queue(
40
40
  queue: job_class || job.payload_object.class.name,
41
41
  error_count: 0,
42
42
  timing: timing,
@@ -6,15 +6,7 @@ module Airbrake
6
6
  module ActiveJob
7
7
  extend ActiveSupport::Concern
8
8
 
9
- # @return [Array<Regexp>] the list of known adapters
10
- ADAPTERS = [/Resque/, /Sidekiq/, /DelayedJob/].freeze
11
-
12
9
  def self.notify_airbrake(exception, job)
13
- queue_adapter = job.class.queue_adapter.to_s
14
-
15
- # Do not notify twice if a queue_adapter is configured already.
16
- raise exception if ADAPTERS.any? { |a| a =~ queue_adapter }
17
-
18
10
  notice = Airbrake.build_notice(exception)
19
11
  notice[:context][:component] = 'active_job'
20
12
  notice[:context][:action] = job.class.name
@@ -30,14 +22,14 @@ module Airbrake
30
22
  block.call
31
23
  end
32
24
  rescue StandardError => exception
33
- Airbrake.notify_queue_sync(
25
+ Airbrake.notify_queue(
34
26
  queue: job.class.name,
35
27
  error_count: 1,
36
28
  timing: 0.01,
37
29
  )
38
30
  raise exception
39
31
  else
40
- Airbrake.notify_queue_sync(
32
+ Airbrake.notify_queue(
41
33
  queue: job.class.name,
42
34
  error_count: 0,
43
35
  timing: timing,
@@ -11,12 +11,19 @@ module Airbrake
11
11
 
12
12
  # @param [] request
13
13
  # @return [Airbrake::Rails::App::Route, nil]
14
+ # rubocop:disable Metrics/AbcSize
14
15
  def self.recognize_route(request)
15
16
  # Duplicate `request` because `recognize` *can* strip the request's
16
17
  # `path_info`, which results in broken engine links (when the engine has
17
18
  # an isolated namespace).
18
19
  request_copy = request.dup
19
20
 
21
+ # Save original script name because `router.recognize(request)` mutates
22
+ # it. It's a Rails bug. More info in:
23
+ # * https://github.com/airbrake/airbrake/issues/1072
24
+ # * https://github.com/rails/rails/issues/31152
25
+ original_script_name = request.env['SCRIPT_NAME']
26
+
20
27
  # We must search every engine individually to find a concrete route. If
21
28
  # we rely only on the `Rails.application.routes.router`, then the
22
29
  # recognize call would return the root route, neglecting PATH_INFO
@@ -26,6 +33,20 @@ module Airbrake
26
33
  # * `Marketing::Engine` recognizes it as `marketing#/pricing` (correct)
27
34
  engines.each do |engine|
28
35
  engine.routes.router.recognize(request_copy) do |route, _params|
36
+ # Restore original script name. Remove this code when/if the Rails
37
+ # bug is fixed: https://github.com/airbrake/airbrake/issues/1072
38
+ request.env['SCRIPT_NAME'] = original_script_name
39
+
40
+ # Skip "catch-all" routes such as:
41
+ # get '*path => 'pages#about'
42
+ #
43
+ # @todo The `glob?` method was added in Rails v4.2.0.beta1. We
44
+ # should remove the `respond_to?` check once we drop old Rails
45
+ # versions support.
46
+ #
47
+ # https://github.com/rails/rails/commit/5460591f0226a9d248b7b4f89186bd5553e7768f
48
+ next if route.respond_to?(:glob?) && route.glob?
49
+
29
50
  path =
30
51
  if engine == ::Rails.application
31
52
  route.path.spec.to_s
@@ -46,6 +67,7 @@ module Airbrake
46
67
 
47
68
  nil
48
69
  end
70
+ # rubocop:enable Metrics/AbcSize
49
71
 
50
72
  def self.engines
51
73
  @engines ||= [*::Rails::Engine.subclasses, ::Rails.application]
@@ -4,9 +4,20 @@ module Airbrake
4
4
  module Rails
5
5
  # BacktraceCleaner is a wrapper around Rails.backtrace_cleaner.
6
6
  class BacktraceCleaner
7
+ # @return [Regexp]
8
+ AIRBRAKE_FRAME_PATTERN = %r{/airbrake/lib/airbrake/}
9
+
7
10
  def self.clean(backtrace)
8
11
  ::Rails.backtrace_cleaner.clean(backtrace).first(1)
9
12
  end
10
13
  end
11
14
  end
12
15
  end
16
+
17
+ if defined?(Rails)
18
+ # Silence own frames to let the cleaner proceed to the next line (and probably
19
+ # find the correct call-site coming from the app code rather this library).
20
+ Rails.backtrace_cleaner.add_silencer do |line|
21
+ line =~ Airbrake::Rails::BacktraceCleaner::AIRBRAKE_FRAME_PATTERN
22
+ end
23
+ end
@@ -1,12 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Monkey-patch Net::HTTP to benchmark it.
4
- Net::HTTP.class_eval do
5
- alias_method :request_without_airbrake, :request
6
-
7
- def request(request, *args, &block)
8
- Airbrake::Rack.capture_timing(:http) do
9
- request_without_airbrake(request, *args, &block)
3
+ module Airbrake
4
+ module Rails
5
+ # Monkey-patch Net::HTTP to benchmark it.
6
+ # @api private
7
+ # @since v10.0.2
8
+ module NetHttp
9
+ def request(request, *args, &block)
10
+ Airbrake::Rack.capture_timing(:http) do
11
+ super(request, *args, &block)
12
+ end
13
+ end
10
14
  end
11
15
  end
12
16
  end
17
+
18
+ Net::HTTP.prepend(Airbrake::Rails::NetHttp)
@@ -5,6 +5,8 @@ module Airbrake
5
5
  # This railtie works for any Rails application that supports railties (Rails
6
6
  # 3.2+ apps). It makes Airbrake Ruby work with Rails and report errors
7
7
  # occurring in the application automatically.
8
+ #
9
+ # rubocop:disable Metrics/ClassLength, Metrics/BlockLength
8
10
  class Railtie < ::Rails::Railtie
9
11
  initializer('airbrake.middleware', after: :load_config_initializers) do |app|
10
12
  # Since Rails 3.2 the ActionDispatch::DebugExceptions middleware is
@@ -44,7 +46,6 @@ module Airbrake
44
46
  require 'airbrake/rake/tasks'
45
47
  end
46
48
 
47
- # rubocop:disable Metrics/BlockLength
48
49
  initializer('airbrake.action_controller') do
49
50
  ActiveSupport.on_load(:action_controller, run_once: true) do
50
51
  # Patches ActionController with methods that allow us to retrieve
@@ -92,7 +93,6 @@ module Airbrake
92
93
  end
93
94
  end
94
95
  end
95
- # rubocop:enable Metrics/BlockLength
96
96
 
97
97
  initializer('airbrake.active_record') do
98
98
  ActiveSupport.on_load(:active_record, run_once: true) do
@@ -112,11 +112,21 @@ module Airbrake
112
112
  )
113
113
 
114
114
  # Filter out parameters from SQL body.
115
- Airbrake.add_performance_filter(
116
- Airbrake::Filters::SqlFilter.new(
117
- ::ActiveRecord::Base.connection_config[:adapter],
118
- ),
119
- )
115
+ if ::ActiveRecord::Base.respond_to?(:connection_db_config)
116
+ # Rails 6.1+ deprecates "connection_config" in favor of
117
+ # "connection_db_config", so we need an updated call.
118
+ Airbrake.add_performance_filter(
119
+ Airbrake::Filters::SqlFilter.new(
120
+ ::ActiveRecord::Base.connection_db_config.configuration_hash[:adapter],
121
+ ),
122
+ )
123
+ else
124
+ Airbrake.add_performance_filter(
125
+ Airbrake::Filters::SqlFilter.new(
126
+ ::ActiveRecord::Base.connection_config[:adapter],
127
+ ),
128
+ )
129
+ end
120
130
  end
121
131
  end
122
132
  end
@@ -142,5 +152,6 @@ module Airbrake
142
152
  end
143
153
  end
144
154
  end
155
+ # rubocop:enable Metrics/ClassLength, Metrics/BlockLength
145
156
  end
146
157
  end
@@ -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 = '10.0.1'.freeze
6
+ AIRBRAKE_VERSION = '10.0.6'.freeze
7
7
  end
@@ -54,12 +54,12 @@ Airbrake.configure do |c|
54
54
  # A list of parameters that should be filtered out of what is sent to
55
55
  # Airbrake. By default, all "password" attributes will have their contents
56
56
  # replaced.
57
- # https://github.com/airbrake/airbrake-ruby#blacklist_keys
58
- c.blacklist_keys = [/password/i, /authorization/i]
57
+ # https://github.com/airbrake/airbrake-ruby#blocklist_keys
58
+ c.blocklist_keys = [/password/i, /authorization/i]
59
59
 
60
60
  # Alternatively, you can integrate with Rails' filter_parameters.
61
61
  # Read more: https://goo.gl/gqQ1xS
62
- # c.blacklist_keys = Rails.application.config.filter_parameters
62
+ # c.blocklist_keys = Rails.application.config.filter_parameters
63
63
  end
64
64
 
65
65
  # A filter that collects request body information. Enable it if you are sure you
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: 10.0.1
4
+ version: 10.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airbrake Technologies, Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-29 00:00:00.000000000 Z
11
+ date: 2020-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: airbrake-ruby
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: appraisal
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: '2'
89
+ version: 2.2.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: '2'
96
+ version: 2.2.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rack
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -268,6 +268,20 @@ dependencies:
268
268
  - - '='
269
269
  - !ruby/object:Gem::Version
270
270
  version: 1.6.0
271
+ - !ruby/object:Gem::Dependency
272
+ name: ffi
273
+ requirement: !ruby/object:Gem::Requirement
274
+ requirements:
275
+ - - '='
276
+ - !ruby/object:Gem::Version
277
+ version: 1.12.2
278
+ type: :development
279
+ prerelease: false
280
+ version_requirements: !ruby/object:Gem::Requirement
281
+ requirements:
282
+ - - '='
283
+ - !ruby/object:Gem::Version
284
+ version: 1.12.2
271
285
  - !ruby/object:Gem::Dependency
272
286
  name: sidekiq
273
287
  requirement: !ruby/object:Gem::Requirement
@@ -420,7 +434,7 @@ homepage: https://airbrake.io
420
434
  licenses:
421
435
  - MIT
422
436
  metadata: {}
423
- post_install_message:
437
+ post_install_message:
424
438
  rdoc_options: []
425
439
  require_paths:
426
440
  - lib
@@ -436,7 +450,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
436
450
  version: '0'
437
451
  requirements: []
438
452
  rubygems_version: 3.1.2
439
- signing_key:
453
+ signing_key:
440
454
  specification_version: 4
441
455
  summary: Airbrake is an online tool that provides robust exception tracking in any
442
456
  of your Ruby applications.