Skip to content

Commit 787fb04

Browse files
committed
Revert "Truncate trace_id for specific LightStep requirements"
This reverts commit a6cc5d8.
1 parent 0c16850 commit 787fb04

File tree

2 files changed

+4
-41
lines changed

2 files changed

+4
-41
lines changed

lightstep/tracer.py

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -82,47 +82,6 @@ def __init__(self, enable_binary_format, recorder, scope_manager):
8282
self.register_propagator(Format.BINARY, BinaryPropagator())
8383
self.register_propagator(LightStepFormat.LIGHTSTEP_BINARY, LightStepBinaryPropagator())
8484

85-
def start_active_span(
86-
self,
87-
operation_name,
88-
child_of=None,
89-
references=None,
90-
tags=None,
91-
start_time=None,
92-
ignore_active_span=False,
93-
finish_on_close=True
94-
):
95-
96-
scope = super(_LightstepTracer, self).start_active_span(
97-
operation_name,
98-
child_of=child_of,
99-
references=references,
100-
tags=tags,
101-
start_time=start_time,
102-
ignore_active_span=ignore_active_span,
103-
finish_on_close=finish_on_close
104-
)
105-
106-
class ScopePatch(scope.__class__):
107-
108-
def __exit__(self, exc_type, exc_val, exc_tb):
109-
110-
self.span.context.trace_id = int(
111-
format(self.span.context.trace_id, "032x")[:16], 16
112-
)
113-
114-
result = super(self.__class__, self).__exit__(
115-
exc_type, exc_val, exc_tb
116-
)
117-
118-
return result
119-
120-
# This monkey patching is done because LightStep requires for the
121-
# trace_id to be 64b long.
122-
scope.__class__ = ScopePatch
123-
124-
return scope
125-
12685
def flush(self):
12786
"""Force a flush of buffered Span data to the LightStep collector."""
12887
self.recorder.flush()

tests/trace-context/trace_context_test_service.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ def hello():
4747
timeout=5.0,
4848
)
4949

50+
scope.span.context.trace_id = int(
51+
format(scope.span.context.trace_id, "032x")[:16], 16
52+
)
53+
5054
return 'Hello, {}!'.format(hello_to)
5155

5256

0 commit comments

Comments
 (0)