Module: Resteze::Instrumentation

Included in:
Client
Defined in:
lib/resteze/instrumentation.rb

Instance Method Summary collapse

Instance Method Details

#execute_request(method, path) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/resteze/instrumentation.rb', line 3

def execute_request(method, path, ...)
  payload = { method: method, path: path, api_module: api_module.name }

  ActiveSupport::Notifications.instrument("request.#{api_module::INSTRUMENTATION_KEY}", payload) do
    super.tap do |response|
      payload[:status]     = response.http_status
      payload[:request_id] = response.request_id
    end
  end
end