airbrake 9.4.5 → 9.5.4

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
- SHA1:
3
- metadata.gz: e3451e5b75e5f477d87dc437e48bc95bee4783bd
4
- data.tar.gz: c13ff23bd4a54accb6ba3b9eadd70fa283836f7e
2
+ SHA256:
3
+ metadata.gz: 1674eebe809e2624774c0d3166fe5e214db9f947a9b41cfcdf4d510268e77993
4
+ data.tar.gz: c902febfb24d2a8147324b8cb9d225ba41529ee89b97ace68be9c5a529885578
5
5
  SHA512:
6
- metadata.gz: 92c00e765d4c72494d5c8c3046df7c6ba28a8a10168c1ca06131838c8ca6225ee461694d61c2cf8ef9a9189cf102eee31b2aec6ad5a8621223ebbf04011ef861
7
- data.tar.gz: eefbe3fdb7e7a9157a5426114fdfe030a8f05cfa8602827bd7efe8d5279f9fc7ee4d8f900d6e94766d78ccdade11359a09edf196bf8ae439f595110ad00eed72
6
+ metadata.gz: ccc91fb99278364f2539ed0a09bc8e60aef3780c651f92b65f05108b320d464f6627daf18c3c838def9d7ac6203fd46c84f333d6d905b0959c9b93aae509a2ff
7
+ data.tar.gz: 151914bb3405cdd4c094a664ef81eb214fe269cacd3af17f8922e2b6bfb79b375f63dcdafe7df06c05aad7a69a1f58358196c3ade5e2fa6f5c43f84347ebab37
@@ -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
36
30
  end
37
31
 
38
32
  def sinatra_route(request)
@@ -3,27 +3,19 @@ require 'airbrake/rails/app'
3
3
 
4
4
  module Airbrake
5
5
  module Rails
6
- # @return [String]
7
- CONTROLLER_KEY = 'controller'.freeze
8
-
9
- # @return [String]
10
- ACTION_KEY = 'action'.freeze
11
-
12
6
  # ActionControllerRouteSubscriber sends route stat information, including
13
7
  # performance data.
14
8
  #
15
9
  # @since v8.0.0
16
10
  class ActionControllerRouteSubscriber
17
- def initialize
18
- @app = Airbrake::Rails::App.new
19
- end
20
-
21
11
  def call(*args)
22
12
  # We don't track routeless events.
23
13
  return unless (routes = Airbrake::Rack::RequestStore[:routes])
24
14
 
25
15
  event = Airbrake::Rails::Event.new(*args)
26
- route = find_route(event.params)
16
+ route = Airbrake::Rails::App.recognize_route(
17
+ Airbrake::Rack::RequestStore[:request]
18
+ )
27
19
  return unless route
28
20
 
29
21
  routes[route.path] = {
@@ -32,15 +24,6 @@ module Airbrake
32
24
  groups: {}
33
25
  }
34
26
  end
35
-
36
- private
37
-
38
- def find_route(params)
39
- @app.routes.find do |route|
40
- route.controller == params[CONTROLLER_KEY] &&
41
- route.action == params[ACTION_KEY]
42
- end
43
- end
44
27
  end
45
28
  end
46
29
  end
@@ -1,42 +1,34 @@
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)
8
+ Route = Struct.new(:path)
9
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) }
13
- end
14
- 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?
10
+ # @param [] request
11
+ # @return [Airbrake::Rails::App::Route, nil]
12
+ def self.recognize_route(request)
13
+ ::Rails.application.routes.router.recognize(request) do |route, _params|
14
+ path =
15
+ if route.app.respond_to?(:app) && route.app.app.respond_to?(:engine_name)
16
+ "#{route.app.app.engine_name}##{route.path.spec}"
17
+ else
18
+ route.path.spec.to_s
19
+ end
26
20
 
27
- hash[engine.engine_name] = eng_routes
21
+ # Rails can recognize multiple routes for the given request. For
22
+ # example, if we visit /users/2/edit, then Rails sees these routes:
23
+ # * "/users/:id/edit(.:format)"
24
+ # * "/"
25
+ #
26
+ # We return the first route as, what it seems, the most optimal
27
+ # approach.
28
+ return Route.new(path)
28
29
  end
29
- end
30
-
31
- def build_route(engine_name, rails_route)
32
- engine_prefix = engine_name
33
- engine_prefix += '#' if engine_prefix
34
30
 
35
- Route.new(
36
- "#{engine_prefix}#{rails_route.path.spec}",
37
- rails_route.defaults[:controller],
38
- rails_route.defaults[:action]
39
- )
31
+ nil
40
32
  end
41
33
  end
42
34
  end
@@ -96,8 +96,11 @@ module Airbrake
96
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.
@@ -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.5'.freeze
4
+ AIRBRAKE_VERSION = '9.5.4'.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.5
4
+ version: 9.5.4
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-10-03 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.7'
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.7'
26
+ version: '4.8'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -240,6 +240,20 @@ dependencies:
240
240
  - - '='
241
241
  - !ruby/object:Gem::Version
242
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
243
257
  - !ruby/object:Gem::Dependency
244
258
  name: sidekiq
245
259
  requirement: !ruby/object:Gem::Requirement
@@ -408,7 +422,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
408
422
  version: '0'
409
423
  requirements: []
410
424
  rubyforge_project:
411
- rubygems_version: 2.6.14.4
425
+ rubygems_version: 2.7.6.2
412
426
  signing_key:
413
427
  specification_version: 4
414
428
  summary: Airbrake is an online tool that provides robust exception tracking in any