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



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

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



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

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