Module: NewRelic::Agent::Instrumentation::Curb::Easy

Included in:
Prepend
Defined in:
lib/new_relic/agent/instrumentation/curb/prepend.rb,
lib/new_relic/agent/instrumentation/curb/instrumentation.rb

Defined Under Namespace

Modules: Prepend

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#_nr_header_strObject

Returns the value of attribute _nr_header_str.



10
11
12
# File 'lib/new_relic/agent/instrumentation/curb/instrumentation.rb', line 10

def _nr_header_str
  @_nr_header_str
end

#_nr_http_verbObject

Returns the value of attribute _nr_http_verb.



10
11
12
# File 'lib/new_relic/agent/instrumentation/curb/instrumentation.rb', line 10

def _nr_http_verb
  @_nr_http_verb
end

#_nr_instrumentedObject

Returns the value of attribute _nr_instrumented.



10
11
12
# File 'lib/new_relic/agent/instrumentation/curb/instrumentation.rb', line 10

def _nr_instrumented
  @_nr_instrumented
end

#_nr_original_on_completeObject

Returns the value of attribute _nr_original_on_complete.



10
11
12
# File 'lib/new_relic/agent/instrumentation/curb/instrumentation.rb', line 10

def _nr_original_on_complete
  @_nr_original_on_complete
end

#_nr_original_on_failureObject

Returns the value of attribute _nr_original_on_failure.



10
11
12
# File 'lib/new_relic/agent/instrumentation/curb/instrumentation.rb', line 10

def _nr_original_on_failure
  @_nr_original_on_failure
end

#_nr_original_on_headerObject

Returns the value of attribute _nr_original_on_header.



10
11
12
# File 'lib/new_relic/agent/instrumentation/curb/instrumentation.rb', line 10

def _nr_original_on_header
  @_nr_original_on_header
end

#_nr_serialObject

Returns the value of attribute _nr_serial.



10
11
12
# File 'lib/new_relic/agent/instrumentation/curb/instrumentation.rb', line 10

def _nr_serial
  @_nr_serial
end

Instance Method Details

#header_str_with_tracingObject

We override this method in order to ensure access to header_str even though we use an on_header callback



56
57
58
59
60
61
62
63
64
# File 'lib/new_relic/agent/instrumentation/curb/instrumentation.rb', line 56

def header_str_with_tracing
  if self._nr_serial
    self._nr_header_str
  else
    # Since we didn't install a header callback for a non-serial request,
    # just fall back to the original implementation.
    yield
  end
end

#http_head_with_tracingObject

We have to hook these three methods separately, as they don’t use Curl::Easy#http



20
21
22
23
# File 'lib/new_relic/agent/instrumentation/curb/instrumentation.rb', line 20

def http_head_with_tracing
  self._nr_http_verb = :HEAD
  yield
end

#http_post_with_tracingObject



25
26
27
28
# File 'lib/new_relic/agent/instrumentation/curb/instrumentation.rb', line 25

def http_post_with_tracing
  self._nr_http_verb = :POST
  yield
end

#http_put_with_tracingObject



30
31
32
33
# File 'lib/new_relic/agent/instrumentation/curb/instrumentation.rb', line 30

def http_put_with_tracing
  self._nr_http_verb = :PUT
  yield
end

#http_with_tracing(verb) ⇒ Object

Hook the #http method to set the verb.



36
37
38
39
# File 'lib/new_relic/agent/instrumentation/curb/instrumentation.rb', line 36

def http_with_tracing(verb)
  self._nr_http_verb = verb.to_s.upcase
  yield
end

#method_with_tracing(verb) ⇒ Object

Record the HTTP verb for future #perform calls



49
50
51
52
# File 'lib/new_relic/agent/instrumentation/curb/instrumentation.rb', line 49

def method_with_tracing(verb)
  self._nr_http_verb = verb.upcase
  yield
end

#perform_with_tracingObject

Hook the #perform method to mark the request as non-parallel.



42
43
44
45
46
# File 'lib/new_relic/agent/instrumentation/curb/instrumentation.rb', line 42

def perform_with_tracing
  self._nr_http_verb ||= :GET
  self._nr_serial = true
  yield
end