Class: ScoutApm::InstrumentManager
- Inherits:
-
Object
- Object
- ScoutApm::InstrumentManager
- Defined in:
- lib/scout_apm/instrument_manager.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#installed_instruments ⇒ Object
readonly
Returns the value of attribute installed_instruments.
Instance Method Summary collapse
-
#initialize(context) ⇒ InstrumentManager
constructor
A new instance of InstrumentManager.
-
#install! ⇒ Object
Loads the instrumention logic.
-
#skip_instrument?(instrument_klass) ⇒ Boolean
Allows users to skip individual instruments via the config file.
Constructor Details
#initialize(context) ⇒ InstrumentManager
Returns a new instance of InstrumentManager.
7 8 9 10 |
# File 'lib/scout_apm/instrument_manager.rb', line 7 def initialize(context) @context = context @installed_instruments = [] end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
3 4 5 |
# File 'lib/scout_apm/instrument_manager.rb', line 3 def context @context end |
#installed_instruments ⇒ Object (readonly)
Returns the value of attribute installed_instruments.
5 6 7 |
# File 'lib/scout_apm/instrument_manager.rb', line 5 def installed_instruments @installed_instruments end |
Instance Method Details
#install! ⇒ Object
Loads the instrumention logic.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/scout_apm/instrument_manager.rb', line 13 def install! case framework when :rails then install_instrument(ScoutApm::Instruments::ActionControllerRails2) when :rails3_or_4 then install_instrument(ScoutApm::Instruments::ActionControllerRails3Rails4) install_instrument(ScoutApm::Instruments::RailsRouter) if config.value("detailed_middleware") install_instrument(ScoutApm::Instruments::MiddlewareDetailed) else install_instrument(ScoutApm::Instruments::MiddlewareSummary) end end install_instrument(ScoutApm::Instruments::ActionView) install_instrument(ScoutApm::Instruments::ActiveRecord) install_instrument(ScoutApm::Instruments::Moped) install_instrument(ScoutApm::Instruments::Mongoid) install_instrument(ScoutApm::Instruments::NetHttp) install_instrument(ScoutApm::Instruments::HttpClient) install_instrument(ScoutApm::Instruments::Memcached) install_instrument(ScoutApm::Instruments::Redis) install_instrument(ScoutApm::Instruments::InfluxDB) install_instrument(ScoutApm::Instruments::Elasticsearch) install_instrument(ScoutApm::Instruments::Grape) rescue logger.warn "Exception loading instruments:" logger.warn $!. logger.warn $!.backtrace end |
#skip_instrument?(instrument_klass) ⇒ Boolean
Allows users to skip individual instruments via the config file
46 47 48 49 |
# File 'lib/scout_apm/instrument_manager.rb', line 46 def skip_instrument?(instrument_klass) instrument_short_name = instrument_klass.name.split("::").last (config.value("disabled_instruments") || []).include?(instrument_short_name) end |