module NewRelic::Agent::Instrumentation::Curb::Easy

Attributes

_nr_header_str[RW]
_nr_http_verb[RW]
_nr_instrumented[RW]
_nr_original_on_complete[RW]
_nr_original_on_failure[RW]
_nr_original_on_header[RW]
_nr_serial[RW]

Public Instance Methods

header_str_with_tracing() { || ... } click to toggle source

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

# 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_tracing() { || ... } click to toggle source

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

# 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_tracing() { || ... } click to toggle source
# 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_tracing() { || ... } click to toggle source
# 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) { || ... } click to toggle source

Hook the http method to set the verb.

# 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) { || ... } click to toggle source

Record the HTTP verb for future perform calls

# 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_tracing() { || ... } click to toggle source

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

# 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