Module: HTTPInstrumentation::Instrumentation::CurbHook

Defined in:
lib/http_instrumentation/instrumentation/curb_hook.rb

Overview

This module is responsible for instrumenting the curb gem.

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.aliasedObject

Returns the value of attribute aliased.



21
22
23
# File 'lib/http_instrumentation/instrumentation/curb_hook.rb', line 21

def aliased
  @aliased
end

Class Method Details

.installed?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/http_instrumentation/instrumentation/curb_hook.rb', line 17

def installed?
  !!(defined?(::Curl::Easy) && ::Curl::Easy.include?(self))
end

.instrument!Object



13
14
15
# File 'lib/http_instrumentation/instrumentation/curb_hook.rb', line 13

def instrument!
  Instrumentation.instrument!(::Curl::Easy, self, :http) if defined?(::Curl::Easy)
end

Instance Method Details

#http(method, *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/curb_hook.rb', line 24

def http(method, *args)
  HTTPInstrumentation.instrument("curb") do |payload|
    retval = if HTTPInstrumentation::Instrumentation::CurbHook.aliased
      http_without_http_instrumentation(method, *args)
    else
      super
    end

    payload[:http_method] = method
    begin
      payload[:url] = url
      payload[:status_code] = response_code
    rescue
    end

    retval
  end
end