module Hoodoo::Monkey::Patch::NewRelicTracedAMQP::InstanceExtensions
Instance methods to patch over Hoodoo::Client::Endpoint::AMQP
.
Public Instance Methods
monkey_send_request( http_message, full_uri )
click to toggle source
Wrap the request with NewRelic’s cross-app transaction tracing. This adds headers to the request and extracts header data from the response. It calls the original implementation via super
.
http_message
-
Hash describing the message to send. See e.g. Hoodoo::Client::Endpoint::AMQP#do_amqp. Note that the header names inside this Hash are the mixed case, HTTP specification style ones like
X-Interaction-ID
and not theRack
names likeHTTP_X_INTERACTION_ID
. full_uri
-
URI being sent to. This is somewhat meaningless when using AMQP but NewRelic requires it.
Calls superclass method
# File lib/hoodoo/monkey/patch/newrelic_traced_amqp.rb, line 53 def monkey_send_request( http_message, full_uri ) amqp_response = nil wrapped_request = AlchemyFluxHTTPRequestWrapper.new( http_message, full_uri ) segment = ::NewRelic::Agent::Transaction.start_external_request_segment( wrapped_request.type, wrapped_request.uri, wrapped_request.method ) begin segment.add_request_headers( wrapped_request ) amqp_response = super( http_message, full_uri ) # The outer block extracts required information from the # object returned by this block. Need to wrap it match the # expected interface. # wrapped_response = AlchemyFluxHTTPResponseWrapper.new( amqp_response ) segment.read_response_headers( wrapped_response ) ensure segment.finish() end return amqp_response end