Module: ScoutApm::Instruments::Typhoeus::TyphoeusInstrumentation
- Defined in:
- lib/scout_apm/instruments/typhoeus.rb
Instance Method Summary collapse
- #run(*args, &block) ⇒ Object
- #scout_desc(verb, uri) ⇒ Object
- #scout_request_url ⇒ Object
- #scout_request_verb ⇒ Object
Instance Method Details
#run(*args, &block) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# 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) ⇒ Object
67 68 69 70 71 72 |
# 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 ⇒ Object
74 75 76 77 78 |
# File 'lib/scout_apm/instruments/typhoeus.rb', line 74 def scout_request_url self.url rescue "" end |
#scout_request_verb ⇒ Object
80 81 82 83 84 |
# File 'lib/scout_apm/instruments/typhoeus.rb', line 80 def scout_request_verb self.[:method].to_s rescue "" end |