Module: NewRelic::Agent::LinkingMetadata

Extended by:
LinkingMetadata
Included in:
LinkingMetadata
Defined in:
lib/new_relic/agent/linking_metadata.rb

Overview

This module contains helper methods related to gathering linking metadata for use with logs in context.

Instance Method Summary collapse

Instance Method Details

#append_service_linking_metadata(metadata) ⇒ Object

Raises:

  • (ArgumentError)


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/new_relic/agent/linking_metadata.rb', line 13

def ()
  raise ArgumentError, 'Missing argument `metadata`' if .nil?

  config = ::NewRelic::Agent.config

  [ENTITY_NAME_KEY] = config[:app_name][0]
  [ENTITY_TYPE_KEY] = ENTITY_TYPE
  [HOSTNAME_KEY] = Hostname.get

  if entity_guid = config[:entity_guid]
    [ENTITY_GUID_KEY] = entity_guid
  end

  
end

#append_trace_linking_metadata(metadata) ⇒ Object

Raises:

  • (ArgumentError)


29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/new_relic/agent/linking_metadata.rb', line 29

def ()
  raise ArgumentError, 'Missing argument `metadata`' if .nil?

  if trace_id = Tracer.current_trace_id
    [TRACE_ID_KEY] = trace_id
  end

  if span_id = Tracer.current_span_id
    [SPAN_ID_KEY] = span_id
  end

  
end