File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -94,8 +94,15 @@ def identifier_from_digest(digest)
9494 end
9595
9696 def format_trace_id ( trace_id )
97- if Datadog . configuration . tracing . trace_id_128_bit_logging_enabled &&
98- !Tracing ::Utils ::TraceId . to_high_order ( trace_id ) . zero?
97+ if Datadog . configuration . tracing . trace_id_128_bit_logging_enabled
98+ format_trace_id_128 ( trace_id )
99+ else
100+ Tracing ::Utils ::TraceId . to_low_order ( trace_id ) . to_s
101+ end
102+ end
103+
104+ def format_trace_id_128 ( trace_id )
105+ if !Tracing ::Utils ::TraceId . to_high_order ( trace_id ) . zero?
99106 Kernel . format ( '%032x' , trace_id )
100107 else
101108 Tracing ::Utils ::TraceId . to_low_order ( trace_id ) . to_s
Original file line number Diff line number Diff line change 11require 'datadog/tracing/tracer'
2+ require 'datadog/tracing/correlation'
23require 'datadog/tracing/trace_operation'
34require 'support/faux_writer'
45require 'datadog/tracing/utils'
@@ -124,13 +125,9 @@ def low_order_trace_id(trace_id)
124125 Datadog ::Tracing ::Utils ::TraceId . to_low_order ( trace_id )
125126 end
126127
127- # Ensures the given trace ID is always formatted using the 128-bit logging format
128- # by wrapping Tracing::Correlation.format_trace_id(trace_id)
128+ ## Wraps call to Datadog::Tracing::Correlation.format_trace_id_128 for better test readability
129129 def trace_id_128_log_injection ( trace_id )
130- RSpec ::Mocks . with_temporary_scope do
131- allow ( Datadog . configuration . tracing ) . to receive ( :trace_id_128_bit_logging_enabled ) . and_return ( true )
132- Datadog ::Tracing ::Correlation . format_trace_id ( trace_id )
133- end
130+ Datadog ::Tracing ::Correlation . format_trace_id_128 ( trace_id )
134131 end
135132
136133 # Wraps call to Tracing::Utils::TraceId.to_high_order and converts to hex
You can’t perform that action at this time.
0 commit comments