Module: ScoutApm::Instruments::NetHttpInstrumentationPrepend

Defined in:
lib/scout_apm/instruments/net_http.rb

Instance Method Summary collapse

Instance Method Details

#request(request, *args, &block) ⇒ Object



62
63
64
65
66
# File 'lib/scout_apm/instruments/net_http.rb', line 62

def request(request, *args, &block)
  self.class.instrument("HTTP", "request", :ignore_children => true, :desc => request_scout_description(request)) do
    super(request, *args, &block)
  end
end

#request_scout_description(req) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/scout_apm/instruments/net_http.rb', line 68

def request_scout_description(req)
  path = req.path
  path = path.path if path.respond_to?(:path)

  # Protect against a nil address value
  if @address.nil?
    return "No Address Found"
  end

  max_length = ScoutApm::Agent.instance.context.config.value('instrument_http_url_length')
  (@address + path.split('?').first)[0..(max_length - 1)]
rescue
  ""
end