class Hoodoo::Monkey::Patch::NewRelicTracedAMQP::AlchemyFluxHTTPRequestWrapper

Wrapper class for an AMQP request which conforms to the API that NewRelic expects.

Public Class Methods

new( http_message, full_uri ) click to toggle source

Wrap the Alchemy Flux http_message aimed at the specified full_uri.

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 the Rack names like HTTP_X_INTERACTION_ID.

full_uri

Full target URI, as a String.

# File lib/hoodoo/monkey/patch/newrelic_traced_amqp.rb, line 107
def initialize( http_message, full_uri )
  @http_message = http_message
  @full_uri     = full_uri
end

Public Instance Methods

[]( key ) click to toggle source

Key lookup is delegated to the headers Hash per NewRelic’s expectations of how a request behaves.

key

Hash key to look up.

# File lib/hoodoo/monkey/patch/newrelic_traced_amqp.rb, line 152
def []( key )
  @http_message[ 'headers' ][ key ]
end
[]=( key, value ) click to toggle source

Key setting is delegated to the headers Hash per NewRelic’s expectations of how a request behaves.

key

Key of Hash entry to modify.

value

New or replacement value for identified Hash entry.

# File lib/hoodoo/monkey/patch/newrelic_traced_amqp.rb, line 162
def []=( key, value )
  @http_message[ 'headers' ][ key ] = value
end
host() click to toggle source

String describing this request’s intended host.

See also: host_from_header.

# File lib/hoodoo/monkey/patch/newrelic_traced_amqp.rb, line 135
def host
  self.host_from_header() || @http_message[ 'host' ]
end
host_from_header() click to toggle source

String descrbing this request’s intended host, according to the Host header. May return nil if none is found.

See also: host.

# File lib/hoodoo/monkey/patch/newrelic_traced_amqp.rb, line 123
def host_from_header
  begin
    @http_message[ 'headers' ][ 'host' ] || @http_message[ 'headers' ][ 'Host' ]
  rescue
    nil
  end
end
method() click to toggle source

String describing this request’s HTTP verb (GET, POST and so-on). String case is undefined, so perform case-insensitive comparisions.

# File lib/hoodoo/monkey/patch/newrelic_traced_amqp.rb, line 143
def method
  @http_message[ 'verb' ]
end
type() click to toggle source

String describing what kind of request this is.

# File lib/hoodoo/monkey/patch/newrelic_traced_amqp.rb, line 114
def type
  'AlchemyFlux'
end
uri() click to toggle source

URI object describing the full request URI.

# File lib/hoodoo/monkey/patch/newrelic_traced_amqp.rb, line 168
def uri
  URI.parse( @full_uri.to_s )
end