Class: NewRelic::Agent::InboundRequestMonitor
- Inherits:
-
Object
- Object
- NewRelic::Agent::InboundRequestMonitor
- Defined in:
- lib/new_relic/agent/monitors/inbound_request_monitor.rb
Direct Known Subclasses
DistributedTracing::CrossAppMonitor, DistributedTracing::Monitor, SyntheticsMonitor
Instance Attribute Summary collapse
-
#obfuscator ⇒ Object
readonly
Returns the value of attribute obfuscator.
Instance Method Summary collapse
- #deserialize_header(encoded_header, key) ⇒ Object
-
#initialize(events) ⇒ InboundRequestMonitor
constructor
A new instance of InboundRequestMonitor.
- #setup_obfuscator ⇒ Object
Constructor Details
#initialize(events) ⇒ InboundRequestMonitor
Returns a new instance of InboundRequestMonitor.
21 22 23 24 25 26 27 |
# 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 |
Instance Attribute Details
#obfuscator ⇒ Object (readonly)
Returns the value of attribute obfuscator.
19 20 21 |
# File 'lib/new_relic/agent/monitors/inbound_request_monitor.rb', line 19 def obfuscator @obfuscator end |
Instance Method Details
#deserialize_header(encoded_header, key) ⇒ Object
33 34 35 36 37 38 39 40 |
# 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.}") nil end |
#setup_obfuscator ⇒ Object
29 30 31 |
# File 'lib/new_relic/agent/monitors/inbound_request_monitor.rb', line 29 def setup_obfuscator @obfuscator = Obfuscator.new(Agent.config[:encoding_key]) end |