Module: Skylight::Probes::NetHTTP::Instrumentation Private

Defined in:
lib/skylight/probes/net_http.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#request(req) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/skylight/probes/net_http.rb', line 7

def request(req, *)
  return super if !started? || Probes::NetHTTP::Probe.disabled?

  method = req.method

  # req['host'] also includes special handling for default ports
  host, port = req["host"] ? req["host"].split(":") : nil

  # If we're connected with a persistent socket
  host ||= address

  path = req.path
  scheme = use_ssl? ? "https" : "http"

  # Contained in the path
  query = nil

  opts = Formatters::HTTP.build_opts(method, scheme, host, port, path, query)

  Skylight.instrument(opts) { super }
end