Class: ScoutApm::Instruments::InfluxDB
- Inherits:
-
Object
- Object
- ScoutApm::Instruments::InfluxDB
- Defined in:
- lib/scout_apm/instruments/influxdb.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
-
#initialize(context) ⇒ InfluxDB
constructor
A new instance of InfluxDB.
- #install(prepend:) ⇒ Object
- #installed? ⇒ Boolean
- #logger ⇒ Object
Constructor Details
#initialize(context) ⇒ InfluxDB
Returns a new instance of InfluxDB.
6 7 8 9 |
# File 'lib/scout_apm/instruments/influxdb.rb', line 6 def initialize(context) @context = context @installed = false end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
4 5 6 |
# File 'lib/scout_apm/instruments/influxdb.rb', line 4 def context @context end |
Instance Method Details
#install(prepend:) ⇒ Object
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 44 45 46 |
# File 'lib/scout_apm/instruments/influxdb.rb', line 19 def install(prepend:) if defined?(::InfluxDB) @installed = true logger.debug "Instrumenting InfluxDB." ::InfluxDB::Client.class_eval do include ScoutApm::Tracer end ::InfluxDB::HTTP.module_eval do def do_request_with_scout_instruments(http, req, data = nil) params = req.path[1..-1].split("?").last cleaned_params = CGI.unescape(params).gsub(/(\s{2,})/,' ') self.class.instrument("InfluxDB", "#{req.path[1..-1].split("?").first.capitalize}", :desc => cleaned_params, :ignore_children => true) do do_request_without_scout_instruments(http, req, data) end end alias_method :do_request_without_scout_instruments, :do_request alias_method :do_request, :do_request_with_scout_instruments end end end |
#installed? ⇒ Boolean
15 16 17 |
# File 'lib/scout_apm/instruments/influxdb.rb', line 15 def installed? @installed end |
#logger ⇒ Object
11 12 13 |
# File 'lib/scout_apm/instruments/influxdb.rb', line 11 def logger context.logger end |