Class: NewRelic::Agent::DistributedTracing::CrossAppMonitor

Inherits:
InboundRequestMonitor show all
Defined in:
lib/new_relic/agent/monitors/cross_app_monitor.rb

Constant Summary collapse

NEWRELIC_TXN_HEADER =
'X-NewRelic-Transaction'.freeze
NEWRELIC_APPDATA_HEADER =
'X-NewRelic-App-Data'.freeze
NEWRELIC_ID_HEADER_KEY =
'HTTP_X_NEWRELIC_ID'.freeze
NEWRELIC_TXN_HEADER_KEY =
'HTTP_X_NEWRELIC_TRANSACTION'.freeze
CONTENT_LENGTH_HEADER_KEY =
'HTTP_CONTENT_LENGTH'.freeze

Instance Attribute Summary

Attributes inherited from InboundRequestMonitor

#obfuscator

Instance Method Summary collapse

Methods inherited from InboundRequestMonitor

#deserialize_header, #initialize, #setup_obfuscator

Constructor Details

This class inherits a constructor from NewRelic::Agent::InboundRequestMonitor

Instance Method Details

#on_finished_configuring(events) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/new_relic/agent/monitors/cross_app_monitor.rb', line 22

def on_finished_configuring(events)
  if CrossAppTracing.cross_app_enabled?
    Deprecator.deprecate('cross_application_tracer')
    ::NewRelic::Agent.logger.warn(
      '[DEPRECATED] Cross application tracing is enabled. Distributed tracing is replacing cross application tracing as the default means of tracing between services. To continue using cross application tracing, enable it with `cross_application_tracer.enabled: true` and `distributed_tracing.enabled: false`'
    )
  end

  register_event_listeners(events)
end

#path_hash(txn_name, seed) ⇒ Object



33
34
35
36
37
38
# File 'lib/new_relic/agent/monitors/cross_app_monitor.rb', line 33

def path_hash(txn_name, seed)
  rotated = ((seed << 1) | (seed >> 31)) & 0xffffffff
  app_name = NewRelic::Agent.config[:app_name].first
  identifier = "#{app_name};#{txn_name}"
  sprintf('%08x', rotated ^ hash_transaction_name(identifier))
end