Class: ScoutApm::Instruments::RailsRouter
- Inherits:
-
Object
- Object
- ScoutApm::Instruments::RailsRouter
- Defined in:
- lib/scout_apm/instruments/rails_router.rb
Instance Method Summary collapse
- #initalize(logger = ScoutApm::Agent.instance.logger) ⇒ Object
- #install ⇒ Object
- #installed? ⇒ Boolean
Instance Method Details
#initalize(logger = ScoutApm::Agent.instance.logger) ⇒ Object
4 5 6 7 |
# File 'lib/scout_apm/instruments/rails_router.rb', line 4 def initalize(logger=ScoutApm::Agent.instance.logger) @logger = logger @installed = false end |
#install ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/scout_apm/instruments/rails_router.rb', line 13 def install @installed = true if defined?(ActionDispatch) && defined?(ActionDispatch::Routing) && defined?(ActionDispatch::Routing::RouteSet) ActionDispatch::Routing::RouteSet.class_eval do def call_with_scout_instruments(*args) req = ScoutApm::RequestManager.lookup req.start_layer(ScoutApm::Layer.new("Router", "Rails")) begin call_without_scout_instruments(*args) ensure req.stop_layer end end alias call_without_scout_instruments call alias call call_with_scout_instruments end end end |
#installed? ⇒ Boolean
9 10 11 |
# File 'lib/scout_apm/instruments/rails_router.rb', line 9 def installed? @installed end |