airbrake 9.4.4 → 9.5.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
- SHA1:
3
- metadata.gz: 645e4f963a8955c17a652cf468917e2ae514f849
4
- data.tar.gz: 4f383442884699b67bd81943fd1c64cb527eb2d1
2
+ SHA256:
3
+ metadata.gz: dc5653068c80669e6ed4a43ffc993715337e59ae4b13169fbc9cf5b82e438804
4
+ data.tar.gz: 272a62d259ac08b1cbd66db11b84fbbae272fb12aea9a6edefd6e3d9d26d18db
5
5
  SHA512:
6
- metadata.gz: dab6ccce21fc171ef09f1d3e103ca6a02e943f997d17731da3d752ffcc789f46647789b189b827a26daace21683edc9dc6d3ada9dfebff3e869f5881d945ec5f
7
- data.tar.gz: 3f2582844fd96b45c1e378a30b5950e32b05393630c2b716e15ffe49c244321e42f1db0646c3d3bf2a315efa09c07d8d16a3a72064c1a8f6c57be36200e09dbd
6
+ metadata.gz: ae7993740f12db8a622f4264157bf71cc9e84e7f2674a1d73e61202217823ea478f3f512cdc9eaeafb828517d5101417be65869c51d1a27624bc22ae9724cbc6
7
+ data.tar.gz: 2bc63b888f983a7622a1e63caa4d6cc76597aacbfcb28dcc79484da038ee2cafc91773edb40a3061b771f091579a5b3f701b5c456f2d7aba35ac0b3af76d03e7
@@ -1,3 +1,5 @@
1
+ require 'airbrake/rails/app'
2
+
1
3
  module Airbrake
2
4
  module Rack
3
5
  # Adds route slugs to context/route.
@@ -23,16 +25,8 @@ module Airbrake
23
25
  private
24
26
 
25
27
  def rails_route(request)
26
- ::Rails.application.routes.router.recognize(request) do |route, _parameters|
27
- # Rails can recognize multiple routes for the given request. For
28
- # example, if we visit /users/2/edit, then Rails sees these routes:
29
- # * "/users/:id/edit(.:format)"
30
- # * "/"
31
- #
32
- # We return the first route as, what it seems, the most optimal
33
- # approach.
34
- return route.path.spec.to_s
35
- end
28
+ return unless (route = Airbrake::Rails::App.recognize_route(request))
29
+ route.path.spec.to_s
36
30
  end
37
31
 
38
32
  def sinatra_route(request)
@@ -8,31 +8,28 @@ module Airbrake
8
8
  #
9
9
  # @since v8.0.0
10
10
  class ActionControllerRouteSubscriber
11
- def initialize
12
- @app = Airbrake::Rails::App.new
13
- end
14
-
15
11
  def call(*args)
16
12
  # We don't track routeless events.
17
13
  return unless (routes = Airbrake::Rack::RequestStore[:routes])
18
14
 
19
15
  event = Airbrake::Rails::Event.new(*args)
20
- route = find_route(event.params)
16
+ route = Airbrake::Rails::App.recognize_route(
17
+ Airbrake::Rack::RequestStore[:request]
18
+ )
21
19
  return unless route
22
20
 
23
- routes[route.path] = {
21
+ routes[find_route_name(route)] = {
24
22
  method: event.method,
25
23
  response_type: event.response_type,
26
24
  groups: {}
27
25
  }
28
26
  end
29
27
 
30
- private
31
-
32
- def find_route(params)
33
- @app.routes.find do |route|
34
- route.controller == params['controller'] &&
35
- route.action == params['action']
28
+ def find_route_name(route)
29
+ if route.app.respond_to?(:app) && route.app.app.respond_to?(:engine_name)
30
+ "#{route.app.app.engine_name}##{route.path.spec}"
31
+ else
32
+ route.path.spec.to_s
36
33
  end
37
34
  end
38
35
  end
@@ -1,43 +1,22 @@
1
1
  module Airbrake
2
2
  module Rails
3
- # App is a wrapper around Rails.application and Rails::Engine.
3
+ # App is a wrapper around Rails.application.
4
4
  #
5
5
  # @since v9.0.3
6
6
  # @api private
7
7
  class App
8
- Route = Struct.new(:path, :controller, :action)
9
-
10
- def routes
11
- @routes ||= app_routes.merge(engine_routes).flat_map do |(engine_name, routes)|
12
- routes.map { |rails_route| build_route(engine_name, rails_route) }
8
+ def self.recognize_route(request)
9
+ ::Rails.application.routes.router.recognize(request) do |route, _params|
10
+ # Rails can recognize multiple routes for the given request. For
11
+ # example, if we visit /users/2/edit, then Rails sees these routes:
12
+ # * "/users/:id/edit(.:format)"
13
+ # * "/"
14
+ #
15
+ # We return the first route as, what it seems, the most optimal
16
+ # approach.
17
+ return route
13
18
  end
14
19
  end
15
-
16
- private
17
-
18
- def app_routes
19
- # Engine name is nil because this is default (non-engine) routes.
20
- { nil => ::Rails.application.routes.routes.routes }
21
- end
22
-
23
- def engine_routes
24
- ::Rails::Engine.subclasses.flat_map.with_object({}) do |engine, hash|
25
- next if (eng_routes = engine.routes.routes.routes).none?
26
-
27
- hash[engine.engine_name] = eng_routes
28
- end
29
- end
30
-
31
- def build_route(engine_name, rails_route)
32
- engine_prefix = engine_name
33
- engine_prefix += '#' if engine_prefix
34
-
35
- Route.new(
36
- "#{engine_prefix}#{rails_route.path.spec}",
37
- rails_route.defaults[:controller],
38
- rails_route.defaults[:action]
39
- )
40
- end
41
20
  end
42
21
  end
43
22
  end
@@ -44,7 +44,7 @@ module Airbrake
44
44
 
45
45
  # rubocop:disable Metrics/BlockLength
46
46
  initializer('airbrake.action_controller') do
47
- ActiveSupport.on_load(:action_controller) do
47
+ ActiveSupport.on_load(:action_controller, run_once: true) do
48
48
  # Patches ActionController with methods that allow us to retrieve
49
49
  # interesting request data. Appends that information to notices.
50
50
  require 'airbrake/rails/action_controller'
@@ -93,11 +93,14 @@ module Airbrake
93
93
  # rubocop:enable Metrics/BlockLength
94
94
 
95
95
  initializer('airbrake.active_record') do
96
- ActiveSupport.on_load(:active_record) do
96
+ ActiveSupport.on_load(:active_record, run_once: true) do
97
97
  # Reports exceptions occurring in some bugged ActiveRecord callbacks.
98
98
  # Applicable only to the versions of Rails lower than 4.2.
99
- require 'airbrake/rails/active_record'
100
- include Airbrake::Rails::ActiveRecord
99
+ if defined?(::Rails) &&
100
+ Gem::Version.new(::Rails.version) <= Gem::Version.new('4.2')
101
+ require 'airbrake/rails/active_record'
102
+ include Airbrake::Rails::ActiveRecord
103
+ end
101
104
 
102
105
  if defined?(ActiveRecord) && Airbrake::Config.instance.query_stats
103
106
  # Send SQL queries.
@@ -117,7 +120,7 @@ module Airbrake
117
120
  end
118
121
 
119
122
  initializer('airbrake.active_job') do
120
- ActiveSupport.on_load(:active_job) do
123
+ ActiveSupport.on_load(:active_job, run_once: true) do
121
124
  # Reports exceptions occurring in ActiveJob jobs.
122
125
  require 'airbrake/rails/active_job'
123
126
  include Airbrake::Rails::ActiveJob
@@ -125,7 +128,7 @@ module Airbrake
125
128
  end
126
129
 
127
130
  initializer('airbrake.action_cable') do
128
- ActiveSupport.on_load(:action_cable) do
131
+ ActiveSupport.on_load(:action_cable, run_once: true) do
129
132
  # Reports exceptions occurring in ActionCable connections.
130
133
  require 'airbrake/rails/action_cable'
131
134
  end
@@ -1,5 +1,5 @@
1
1
  # We use Semantic Versioning v2.0.0
2
2
  # More information: http://semver.org/
3
3
  module Airbrake
4
- AIRBRAKE_VERSION = '9.4.4'.freeze
4
+ AIRBRAKE_VERSION = '9.5.3'.freeze
5
5
  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: 9.4.4
4
+ version: 9.5.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: 2019-09-18 00:00:00.000000000 Z
11
+ date: 2019-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: airbrake-ruby
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.6'
19
+ version: '4.8'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '4.6'
26
+ version: '4.8'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -226,6 +226,34 @@ dependencies:
226
226
  - - '='
227
227
  - !ruby/object:Gem::Version
228
228
  version: 1.13.0
229
+ - !ruby/object:Gem::Dependency
230
+ name: minitest
231
+ requirement: !ruby/object:Gem::Requirement
232
+ requirements:
233
+ - - '='
234
+ - !ruby/object:Gem::Version
235
+ version: 5.11.3
236
+ type: :development
237
+ prerelease: false
238
+ version_requirements: !ruby/object:Gem::Requirement
239
+ requirements:
240
+ - - '='
241
+ - !ruby/object:Gem::Version
242
+ version: 5.11.3
243
+ - !ruby/object:Gem::Dependency
244
+ name: rack-cache
245
+ requirement: !ruby/object:Gem::Requirement
246
+ requirements:
247
+ - - '='
248
+ - !ruby/object:Gem::Version
249
+ version: 1.9.0
250
+ type: :development
251
+ prerelease: false
252
+ version_requirements: !ruby/object:Gem::Requirement
253
+ requirements:
254
+ - - '='
255
+ - !ruby/object:Gem::Version
256
+ version: 1.9.0
229
257
  - !ruby/object:Gem::Dependency
230
258
  name: sidekiq
231
259
  requirement: !ruby/object:Gem::Requirement
@@ -394,7 +422,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
394
422
  version: '0'
395
423
  requirements: []
396
424
  rubyforge_project:
397
- rubygems_version: 2.6.14.4
425
+ rubygems_version: 2.7.6.2
398
426
  signing_key:
399
427
  specification_version: 4
400
428
  summary: Airbrake is an online tool that provides robust exception tracking in any