Module: SolidApm::SpanSubscriber::NetHttp::NetHttpInstrumentationPrepend

Defined in:
app/models/solid_apm/span_subscriber/net_http.rb

Overview

Instance Method Summary collapse

Instance Method Details

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



21
22
23
24
25
# File 'app/models/solid_apm/span_subscriber/net_http.rb', line 21

def request(request, *args, &block)
  ActiveSupport::Notifications.instrument PATTERN, request_solid_apm_description(request) do
    super(request, *args, &block)
  end
end

#request_solid_apm_description(req) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/models/solid_apm/span_subscriber/net_http.rb', line 27

def request_solid_apm_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 = 500
  req.method.upcase + " " + (@address + path.split('?').first)[0..(max_length - 1)]
rescue
  ""
end