minitrace-rust icon indicating copy to clipboard operation
minitrace-rust copied to clipboard

minitrace does not work on monoio

Open jon-chuang opened this issue 3 years ago • 6 comments

minitrace = 0.4.0 monoio = 0.0.4

collector.collect().await does not return

jon-chuang avatar Feb 23 '22 05:02 jon-chuang

Some notes: GlobalCollector receives and processes the command, but the callback via futures::channel::oneshot::channel fails. Investigating why now.

Edit:

  1. tested that this does not work by substituting tokio::sync::oneshot::channel
  2. works with std::sync::mpsc::channel (unbounded)

jon-chuang avatar Feb 23 '22 05:02 jon-chuang

Can you provide a minimal reproducible example?

zhongzc avatar Feb 23 '22 07:02 zhongzc

Yes

let mut rt_ = monoio::RuntimeBuilder::new().build().unwrap();

rt_.block_on(async move {
    let (root, collector) = Span::root("hi!");
    let spans = collector.collect().await;
    println!("spans: {:?}", spans);
});

If you instrument, commit_collect, you will see that rx.await never gets polled successfully.

jon-chuang avatar Feb 23 '22 08:02 jon-chuang

For this example, I'm afraid it's a misuse of minitrace.

The root span should be dropped before collect, or the collection will be never performed.

You can try:

let mut rt_ = monoio::RuntimeBuilder::new().build().unwrap();

rt_.block_on(async move {
    let (root, collector) = Span::root("hi!");
    drop(root);
    let spans = collector.collect().await;
    println!("spans: {:?}", spans);
});

zhongzc avatar Feb 23 '22 08:02 zhongzc

my apologies, it fails with drop(root) and

fn().in_span(root).await;

too.

Note that for these cases, it works when I swap out oneshot::channel with std::sync::mpsc::channel. I have not tried tokio and futures unbounded/bounded channels.

jon-chuang avatar Feb 23 '22 08:02 jon-chuang

my apologies, it fails with drop(root) and

fn().in_span(root).await;

too.

Note that for these cases, it works when I swap out oneshot::channel with std::sync::mpsc::channel. I have not tried tokio and futures unbounded/bounded channels.

Got. Seems an issue from monoio. We can discuss this further over here.

zhongzc avatar Feb 23 '22 08:02 zhongzc