Open op8867555 opened 5 months ago
Your span never finishes so it can never be sent. Try creating a spans inside the loop.
Sorry I didn't make it clear, I'm actually doing a busy loop:
#[tracing::instrument]
fn test() {
loop {
read();
}
}
#[tracing::instrument]
fn read() {
while ptr.read_volatile() == 0 {}
info!("some log")
}
And when you try with spawm
instead of spawn_blocking
, then it works?
I'll try to take a look when I have some time, just trying to rule out as much as possible beforehand.
Just tried that, It seems the issue happens with spawn
as well.
spawn
:
use tracing::Instrument;
tokio::spawn(async {
// something
}.in_current_span())
spawn_blocking
:
#[allow(unused_mut)]
let mut block = ; // something
let span = tracing::span::Span::current();
tokio::task::spawn_blocking(move || {
let _enter = span.enter();
block()
})
Bug Report
Version
Platform
Description
I tried this code:
I expected to see this happen:
RUST_LOG=trace
, there should be someh2
/tonic
logs But none of them happens, it only output my application logs: