Module: HTTPInstrumentation::Instrumentation::HTTPHook
- Defined in:
- lib/http_instrumentation/instrumentation/http_hook.rb
Overview
This module is responsible for instrumenting the http gem.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.installed? ⇒ Boolean
17 18 19 |
# File 'lib/http_instrumentation/instrumentation/http_hook.rb', line 17 def installed? !!(defined?(::HTTP::Client) && ::HTTP::Client.include?(self)) end |
.instrument! ⇒ Object
13 14 15 |
# File 'lib/http_instrumentation/instrumentation/http_hook.rb', line 13 def instrument! Instrumentation.instrument!(::HTTP::Client, self) if defined?(::HTTP::Client) end |
Instance Method Details
#perform(request) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/http_instrumentation/instrumentation/http_hook.rb', line 22 def perform(request, *) HTTPInstrumentation.instrument("http") do |payload| response = super begin payload[:http_method] = request.verb payload[:url] = request.uri payload[:status_code] = response.status rescue end response end end |