Class: ScoutApm::Instruments::Sinatra
- Inherits:
-
Object
- Object
- ScoutApm::Instruments::Sinatra
- Defined in:
- lib/scout_apm/instruments/sinatra.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #initalize(logger = ScoutApm::Agent.instance.context.logger) ⇒ Object
- #install(prepend:) ⇒ Object
- #installed? ⇒ Boolean
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
7 8 9 |
# File 'lib/scout_apm/instruments/sinatra.rb', line 7 def logger @logger end |
Instance Method Details
#initalize(logger = ScoutApm::Agent.instance.context.logger) ⇒ Object
9 10 11 12 |
# File 'lib/scout_apm/instruments/sinatra.rb', line 9 def initalize(logger=ScoutApm::Agent.instance.context.logger) @logger = logger @installed = false end |
#install(prepend:) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/scout_apm/instruments/sinatra.rb', line 18 def install(prepend:) if defined?(::Sinatra) && defined?(::Sinatra::Base) && ::Sinatra::Base.private_method_defined?(:dispatch!) @installed = true logger.info "Instrumenting Sinatra" ::Sinatra::Base.class_eval do include ScoutApm::Tracer include ScoutApm::Instruments::SinatraInstruments alias dispatch_without_scout_instruments! dispatch! alias dispatch! dispatch_with_scout_instruments! end end end |
#installed? ⇒ Boolean
14 15 16 |
# File 'lib/scout_apm/instruments/sinatra.rb', line 14 def installed? @installed end |