Revert "Parent is now always passed in via Context, intead of Span or SpanContext (#1146)"
This reverts commit 8cf8110987.
This commit is contained in:
parent
06a8236b5c
commit
82ba3faf67
|
|
@ -159,7 +159,7 @@ class ZipkinSpanExporter(SpanExporter):
|
||||||
|
|
||||||
zipkin_spans = []
|
zipkin_spans = []
|
||||||
for span in spans:
|
for span in spans:
|
||||||
context = span.get_span_context()
|
context = span.get_context()
|
||||||
trace_id = context.trace_id
|
trace_id = context.trace_id
|
||||||
span_id = context.span_id
|
span_id = context.span_id
|
||||||
|
|
||||||
|
|
@ -205,7 +205,7 @@ class ZipkinSpanExporter(SpanExporter):
|
||||||
|
|
||||||
if isinstance(span.parent, Span):
|
if isinstance(span.parent, Span):
|
||||||
zipkin_span["parentId"] = format(
|
zipkin_span["parentId"] = format(
|
||||||
span.parent.get_span_context().span_id, "016x"
|
span.parent.get_context().span_id, "016x"
|
||||||
)
|
)
|
||||||
elif isinstance(span.parent, SpanContext):
|
elif isinstance(span.parent, SpanContext):
|
||||||
zipkin_span["parentId"] = format(span.parent.span_id, "016x")
|
zipkin_span["parentId"] = format(span.parent.span_id, "016x")
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ class TestZipkinSpanExporter(unittest.TestCase):
|
||||||
is_remote=False,
|
is_remote=False,
|
||||||
trace_flags=TraceFlags(TraceFlags.SAMPLED),
|
trace_flags=TraceFlags(TraceFlags.SAMPLED),
|
||||||
)
|
)
|
||||||
parent_span_context = trace_api.SpanContext(
|
parent_context = trace_api.SpanContext(
|
||||||
trace_id, parent_id, is_remote=False
|
trace_id, parent_id, is_remote=False
|
||||||
)
|
)
|
||||||
other_context = trace_api.SpanContext(
|
other_context = trace_api.SpanContext(
|
||||||
|
|
@ -157,12 +157,12 @@ class TestZipkinSpanExporter(unittest.TestCase):
|
||||||
trace._Span(
|
trace._Span(
|
||||||
name=span_names[0],
|
name=span_names[0],
|
||||||
context=span_context,
|
context=span_context,
|
||||||
parent=parent_span_context,
|
parent=parent_context,
|
||||||
events=(event,),
|
events=(event,),
|
||||||
links=(link,),
|
links=(link,),
|
||||||
),
|
),
|
||||||
trace._Span(
|
trace._Span(
|
||||||
name=span_names[1], context=parent_span_context, parent=None
|
name=span_names[1], context=parent_context, parent=None
|
||||||
),
|
),
|
||||||
trace._Span(
|
trace._Span(
|
||||||
name=span_names[2], context=other_context, parent=None
|
name=span_names[2], context=other_context, parent=None
|
||||||
|
|
@ -328,14 +328,12 @@ class TestZipkinSpanExporter(unittest.TestCase):
|
||||||
is_remote=False,
|
is_remote=False,
|
||||||
trace_flags=TraceFlags(TraceFlags.SAMPLED),
|
trace_flags=TraceFlags(TraceFlags.SAMPLED),
|
||||||
)
|
)
|
||||||
parent_span_context = trace_api.SpanContext(
|
parent_context = trace_api.SpanContext(
|
||||||
trace_id, parent_id, is_remote=False
|
trace_id, parent_id, is_remote=False
|
||||||
)
|
)
|
||||||
|
|
||||||
otel_span = trace._Span(
|
otel_span = trace._Span(
|
||||||
name=span_names[0],
|
name=span_names[0], context=span_context, parent=parent_context,
|
||||||
context=span_context,
|
|
||||||
parent=parent_span_context,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
otel_span.start(start_time=start_time)
|
otel_span.start(start_time=start_time)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue