diff --git a/src/formatter.rs b/src/formatter.rs index b08b8ab..8fb47be 100644 --- a/src/formatter.rs +++ b/src/formatter.rs @@ -8,7 +8,7 @@ use std::io; use chrono::Utc; -use opentelemetry::trace::{SpanId, TraceContextExt, TraceId}; +use opentelemetry::trace::{SpanId, TraceId}; use serde::ser::{SerializeMap, Serializer as _}; use serde::Serialize; use tracing::{Event, Subscriber}; @@ -44,19 +44,9 @@ fn lookup_trace_info(span_ref: &SpanRef) -> Option where S: Subscriber + for<'a> LookupSpan<'a>, { - span_ref.extensions().get::().map(|o| { - // If the parent ID is empty/0 - then fall back to the builder's ID - let parent_span_cx = o.parent_cx.span(); - - let trace_id = if parent_span_cx.span_context().trace_id() != TraceId::INVALID { - parent_span_cx.span_context().trace_id() - } else { - o.builder.trace_id.unwrap_or(TraceId::INVALID) - }; - TraceInfo { - trace_id: trace_id.into(), - span_id: o.builder.span_id.unwrap_or(SpanId::INVALID).into(), - } + span_ref.extensions().get::().map(|o| TraceInfo { + trace_id: o.builder.trace_id.unwrap_or(TraceId::INVALID).into(), + span_id: o.builder.span_id.unwrap_or(SpanId::INVALID).into(), }) }