lib/instana/tracing/span.rb in instana-1.197.0.pre1 vs lib/instana/tracing/span.rb in instana-1.197.0.pre2

- old
+ new

@@ -26,12 +26,18 @@ end if parent_ctx.is_a?(::Instana::SpanContext) @is_root = false - @data[:t] = parent_ctx.trace_id # Trace ID + # If we have a parent trace, link to it + if parent_ctx.trace_id + @data[:t] = parent_ctx.trace_id # Trace ID + @data[:p] = parent_ctx.span_id # Parent ID + else + @data[:t] = ::Instana::Util.generate_id + end + @data[:s] = ::Instana::Util.generate_id # Span ID - @data[:p] = parent_ctx.span_id # Parent ID @baggage = parent_ctx.baggage.dup @level = parent_ctx.level else # No parent specified so we're starting a new Trace - this will be the root span