Module: HTTPInstrumentation::Instrumentation::HTTPHook
- Defined in:
- lib/http_instrumentation/instrumentation/http_hook.rb
Overview
This module is responsible for instrumenting the http gem.
Class Attribute Summary collapse
-
.aliased ⇒ Object
Returns the value of attribute aliased.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.aliased ⇒ Object
Returns the value of attribute aliased.
21 22 23 |
# File 'lib/http_instrumentation/instrumentation/http_hook.rb', line 21 def aliased @aliased end |
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, :perform) if defined?(::HTTP::Client) end |
Instance Method Details
#perform(request, *args) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/http_instrumentation/instrumentation/http_hook.rb', line 24 def perform(request, *args) HTTPInstrumentation.instrument("http") do |payload| response = if HTTPInstrumentation::Instrumentation::HTTPHook.aliased perform_without_http_instrumentation(request, *args) else super end begin payload[:http_method] = request.verb payload[:url] = request.uri payload[:status_code] = response.status rescue end response end end |