class NewRelic::Agent::InboundRequestMonitor

Attributes

obfuscator[R]

Public Class Methods

new(events) click to toggle source
# File lib/new_relic/agent/monitors/inbound_request_monitor.rb, line 21
def initialize(events)
  events.subscribe(:initial_configuration_complete) do
    # This requires :encoding_key, so must wait until :initial_configuration_complete
    setup_obfuscator
    on_finished_configuring(events)
  end
end

Public Instance Methods

deserialize_header(encoded_header, key) click to toggle source
# File lib/new_relic/agent/monitors/inbound_request_monitor.rb, line 33
def deserialize_header(encoded_header, key)
  decoded_header = obfuscator.deobfuscate(encoded_header)
  ::JSON.load(decoded_header)
rescue => err
  # If we have a failure of any type here, just return nil and carry on
  NewRelic::Agent.logger.debug("Failure deserializing encoded header '#{key}' in #{self.class}, #{err.class}, #{err.message}")
  nil
end
setup_obfuscator() click to toggle source
# File lib/new_relic/agent/monitors/inbound_request_monitor.rb, line 29
def setup_obfuscator
  @obfuscator = Obfuscator.new(Agent.config[:encoding_key])
end