Skip to content

Commit 53087f8

Browse files
committed
init new TraceOperation for baggage if there is no active_trace already
1 parent 166ea2e commit 53087f8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/datadog/tracing.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,10 @@ def log_correlation
128128
end
129129

130130
def baggage
131-
trace = active_trace
132-
active_trace.baggage if trace
131+
# Baggage should not be dependent on there being an active trace.
132+
# So we create a new TraceOperation if there isn't one.
133+
active_trace ||= TraceOperation.new
134+
active_trace.baggage
133135
end
134136

135137
# Gracefully shuts down the tracer.

0 commit comments

Comments
 (0)