Skip to content

Commit

Permalink
Resolve conflicts and align PR with "concurrent span switching detect…
Browse files Browse the repository at this point in the history
…ion" 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.
  • Loading branch information
hrmsk66 committed Sep 22, 2023
1 parent ab6bc77 commit 4c66dca
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,12 +406,11 @@ where
bufs.flush_current_buf(writer)
}

fn get_timestamp<S>(&self, id: &Id, ctx: &Context<S>) -> Option<String>
fn get_timestamp<S>(&self, span: SpanRef<S>) -> Option<String>
where
S: Subscriber + for<'span> LookupSpan<'span>,
{
let ctx = ctx.span(id)?;
let ext = ctx.extensions();
let ext = span.extensions();
let data = ext
.get::<Data>()
.expect("Data cannot be found in extensions");
Expand Down Expand Up @@ -548,8 +547,8 @@ where

// check if this event occurred in the context of a span.
// if it has, get the start time of this span.
if let Some(id) = ctx.current_span().id() {
if let Some(timestamp) = self.get_timestamp(id, &ctx) {
if let Some(span) = span {
if let Some(timestamp) = self.get_timestamp(span) {
write!(&mut event_buf, "{}", timestamp).expect("Unable to write to buffer");
}
}
Expand Down

0 comments on commit 4c66dca

Please sign in to comment.