Skip to content

Commit 040c57a

Browse files
authored
Set builder parent span to None when manually setting parent (#26)
## Motivation When I tried to find a parent span as someone not familiar with the code I tried using what's in the builder and if there's None I tried the parent context (which always has trace ID, it just might be invalid). This change should simplify this for people unfamiliar with the codebase by getting rid of the trace ID that's not used. ## Solution Set trace ID in builder to `None`. It has not been used anywhere if parent_cx contained a valid trace ID so no other changes are needed. Signed-off-by: David Mládek <[email protected]>
1 parent 5ce1b10 commit 040c57a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/span_ext.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ impl OpenTelemetrySpanExt for tracing::Span {
124124
get_context.with_context(subscriber, id, move |data, _tracer| {
125125
if let Some(cx) = cx.take() {
126126
data.parent_cx = cx;
127+
data.builder.trace_id = None;
127128
}
128129
});
129130
}

0 commit comments

Comments
 (0)