lib/datadog/tracing/correlation.rb in ddtrace-1.12.1 vs lib/datadog/tracing/correlation.rb in ddtrace-1.13.0

- old
+ new

@@ -21,11 +21,10 @@ :span_id, :span_name, :span_resource, :span_service, :span_type, - :trace_id, :trace_name, :trace_resource, :trace_service, :version @@ -63,25 +62,23 @@ @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}=#{logging_trace_id}" + attributes << "#{LOG_ATTR_TRACE_ID}=#{trace_id}" attributes << "#{LOG_ATTR_SPAN_ID}=#{span_id}" attributes.join(' ') end end - private - - def logging_trace_id - @logging_trace_id ||= - if Datadog.configuration.tracing.trace_id_128_bit_logging_enabled && - !Tracing::Utils::TraceId.to_high_order(@trace_id).zero? - Kernel.format('%032x', trace_id) - else - Tracing::Utils::TraceId.to_low_order(@trace_id) - end + # DEV-2.0: This public method was returning an Integer, but with 128 bit trace id it would return a String. + def trace_id + if Datadog.configuration.tracing.trace_id_128_bit_logging_enabled && + !Tracing::Utils::TraceId.to_high_order(@trace_id).zero? + Kernel.format('%032x', @trace_id) + else + Tracing::Utils::TraceId.to_low_order(@trace_id) + end end end module_function