module ScoutApm::Instruments::Typhoeus::TyphoeusInstrumentation

Public Instance Methods

run(*args, &block) click to toggle source
Calls superclass method
# File lib/scout_apm/instruments/typhoeus.rb, line 53
def run(*args, &block)
  layer = ScoutApm::Layer.new("HTTP", scout_request_verb)
  layer.desc = scout_desc(scout_request_verb, scout_request_url)

  req = ScoutApm::RequestManager.lookup
  req.start_layer(layer)

  begin
    super(*args, &block)
  ensure
    req.stop_layer
  end
end
scout_desc(verb, uri) click to toggle source
# File lib/scout_apm/instruments/typhoeus.rb, line 67
def scout_desc(verb, uri)
  max_length = ScoutApm::Agent.instance.context.config.value('instrument_http_url_length')
  (String(uri).split('?').first)[0..(max_length - 1)]
rescue
  ""
end
scout_request_url() click to toggle source
# File lib/scout_apm/instruments/typhoeus.rb, line 74
def scout_request_url
  self.url
rescue
  ""
end
scout_request_verb() click to toggle source
# File lib/scout_apm/instruments/typhoeus.rb, line 80
def scout_request_verb
  self.options[:method].to_s
rescue
  ""
end