Method: Datadog::Tracing::Correlation::Identifier#to_log_format

Defined in:
lib/datadog/tracing/correlation.rb

#to_log_formatObject

This method (#to_log_format) implements an algorithm by prefixing keys for nested values but the algorithm makes the constants implicit. Hence, we use it for validation during test.



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/datadog/tracing/correlation.rb', line 62

def to_log_format
  @log_format ||= begin
    attributes = []
    attributes << "#{LOG_ATTR_ENV}=#{env}" unless env.nil?
    attributes << "#{LOG_ATTR_SERVICE}=#{service}"
    attributes << "#{LOG_ATTR_VERSION}=#{version}" unless version.nil?
    attributes << "#{LOG_ATTR_TRACE_ID}=#{trace_id}"
    attributes << "#{LOG_ATTR_SPAN_ID}=#{span_id}"
    attributes << "#{LOG_ATTR_SOURCE}=#{Core::Logging::Ext::DD_SOURCE}"
    attributes.join(' ')
  end
end