class HTTP::Features::Instrumentation


and ‘finish` so the duration of the request can be calculated.
* `request.http` after the response is recieved, and contains `start`
* `start_request.http` before the request is made, so you can log the reqest being started
Emits two events on every request:
.get(“example.com/”)
.use(instrumentation: {instrumenter: ActiveSupport::Notifications.instrumenter})
HTTP
Be sure to specify the instrumenter when enabling the feature:
Emits a single event like `“request.{namespace}”`, eg `“request.http”`.
namespace of ’http’ which may be overridden with a ‘:namespace` param.
ActiveSupport::Notifications-compatible instrumenter. Defaults to use a
Instrument requests and responses. Expects an

def initialize(instrumenter: NullInstrumenter.new, namespace: "http")

def initialize(instrumenter: NullInstrumenter.new, namespace: "http")
  @instrumenter = instrumenter
  @name = "request.#{namespace}"
  @error_name = "error.#{namespace}"
end

def on_error(request, error)

def on_error(request, error)
  instrumenter.instrument(error_name, :request => request, :error => error)
end

def wrap_request(request)

def wrap_request(request)
  # Emit a separate "start" event, so a logger can print the request
  # being run without waiting for a response
  instrumenter.instrument("start_#{name}", :request => request)
  instrumenter.start(name, :request => request)
  request
end

def wrap_response(response)

def wrap_response(response)
  instrumenter.finish(name, :response => response)
  response
end