Skip to content

Commit 4c66dca

Browse files
committed
Resolve conflicts and align PR with "concurrent span switching detection" changes.
Rebased to resolve merge conflicts and updated PR to match changes in commit 8ccafe8 by @ten3roberts. The commit simplifies how Span's Extensions is retrieved.
1 parent ab6bc77 commit 4c66dca

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,12 +406,11 @@ where
406406
bufs.flush_current_buf(writer)
407407
}
408408

409-
fn get_timestamp<S>(&self, id: &Id, ctx: &Context<S>) -> Option<String>
409+
fn get_timestamp<S>(&self, span: SpanRef<S>) -> Option<String>
410410
where
411411
S: Subscriber + for<'span> LookupSpan<'span>,
412412
{
413-
let ctx = ctx.span(id)?;
414-
let ext = ctx.extensions();
413+
let ext = span.extensions();
415414
let data = ext
416415
.get::<Data>()
417416
.expect("Data cannot be found in extensions");
@@ -548,8 +547,8 @@ where
548547

549548
// check if this event occurred in the context of a span.
550549
// if it has, get the start time of this span.
551-
if let Some(id) = ctx.current_span().id() {
552-
if let Some(timestamp) = self.get_timestamp(id, &ctx) {
550+
if let Some(span) = span {
551+
if let Some(timestamp) = self.get_timestamp(span) {
553552
write!(&mut event_buf, "{}", timestamp).expect("Unable to write to buffer");
554553
}
555554
}

0 commit comments

Comments
 (0)