scout_apm 1.2.0.pre7 → 1.2.0.pre8

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
  SHA1:
3
- metadata.gz: 3abc250d198c2c94554f6977fdcb04e03be40bed
4
- data.tar.gz: ddea53a31392514870dc61ef93fde2f8a9a2e9a2
3
+ metadata.gz: 9b5272cb3adff0eda6e90f8b9e25aedec12fc44a
4
+ data.tar.gz: a2548f87f76ab5d4d815fad9c4d4d768a247894d
5
5
  SHA512:
6
- metadata.gz: c452fd04a51d42b00ad0ff8fa13f913d9943917f4e7adf1a19826c092690c34ef2cfaea2637ff6ce2850d564c6eb49609d5f4305f1b4f5f111a6d21716a52e55
7
- data.tar.gz: 9f21f4c8ab460f6c41147a14f465dd6a8fdfb6700691fbb05977f9c32575769a8bd2034551b48b5aff8ca9e1f596103deeaa4b597568629dfbf59af7605ca497
6
+ metadata.gz: 34d61872e85d43f679c1cc50713fd73ed7d9f23ad01491d0d1202a14ece674773b5afb0357e1dc57baf72837699d9456df7fac74a9624de0ef12d51fc594a23a
7
+ data.tar.gz: ecc854b429e7ef8c920fc8209d7c71023426b4b85bacdd64debbcbe00cb9b460f99ae0321d0ca246fe563eb0044f98842538a74b2eb45c1b0ab024e7554e6c5a
@@ -212,6 +212,7 @@ module ScoutApm
212
212
  when :rails3_or_4 then
213
213
  install_instrument(ScoutApm::Instruments::ActionControllerRails3)
214
214
  install_instrument(ScoutApm::Instruments::Middleware)
215
+ install_instrument(ScoutApm::Instruments::RailsRouter)
215
216
  when :sinatra then install_instrument(ScoutApm::Instruments::Sinatra)
216
217
  end
217
218
  end
@@ -0,0 +1,36 @@
1
+ module ScoutApm
2
+ module Instruments
3
+ class RailsRouter
4
+ def initalize(logger=ScoutApm::Agent.instance.logger)
5
+ @logger = logger
6
+ @installed = false
7
+ end
8
+
9
+ def installed?
10
+ @installed
11
+ end
12
+
13
+ def install
14
+ @installed = true
15
+
16
+ if defined?(ActionDispatch) && defined?(ActionDispatch::Routing) && defined?(ActionDispatch::Routing::RouteSet)
17
+ ActionDispatch::Routing::RouteSet.class_eval do
18
+ def call_with_scout_instruments(*args)
19
+ req = ScoutApm::RequestManager.lookup
20
+ req.start_layer(ScoutApm::Layer.new("Router", "Rails"))
21
+
22
+ begin
23
+ call_without_scout_instruments(*args)
24
+ ensure
25
+ req.stop_layer
26
+ end
27
+ end
28
+
29
+ alias call_without_scout_instruments call
30
+ alias call call_with_scout_instruments
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,4 +1,4 @@
1
1
  module ScoutApm
2
- VERSION = "1.2.0.pre7"
2
+ VERSION = "1.2.0.pre8"
3
3
  end
4
4
 
data/lib/scout_apm.rb CHANGED
@@ -66,6 +66,7 @@ require 'scout_apm/instruments/active_record'
66
66
  require 'scout_apm/instruments/action_controller_rails_2'
67
67
  require 'scout_apm/instruments/action_controller_rails_3'
68
68
  require 'scout_apm/instruments/middleware'
69
+ require 'scout_apm/instruments/rails_router'
69
70
  require 'scout_apm/instruments/sinatra'
70
71
  require 'scout_apm/instruments/process/process_cpu'
71
72
  require 'scout_apm/instruments/process/process_memory'
@@ -107,7 +108,7 @@ require 'scout_apm/serializers/deploy_serializer'
107
108
 
108
109
  require 'scout_apm/middleware'
109
110
 
110
- if defined?(Rails) && defined?(Rails::VERSION) && defined?(Rails::VERSION::MAJOR) && Rails::VERSION::MAJOR >= 3
111
+ if defined?(Rails) && defined?(Rails::VERSION) && defined?(Rails::VERSION::MAJOR) && Rails::VERSION::MAJOR >= 3 && defined?(Rails::Railtie)
111
112
  module ScoutApm
112
113
  class Railtie < Rails::Railtie
113
114
  initializer "scout_apm.start" do |app|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scout_apm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.pre7
4
+ version: 1.2.0.pre8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Haynes
@@ -98,6 +98,7 @@ files:
98
98
  - lib/scout_apm/instruments/net_http.rb
99
99
  - lib/scout_apm/instruments/process/process_cpu.rb
100
100
  - lib/scout_apm/instruments/process/process_memory.rb
101
+ - lib/scout_apm/instruments/rails_router.rb
101
102
  - lib/scout_apm/instruments/sinatra.rb
102
103
  - lib/scout_apm/layaway.rb
103
104
  - lib/scout_apm/layaway_file.rb