Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Lucio Franco
    @LucioFranco
    my hack of an impl
    :)
    Eliza Weisman
    @hawkw
    thanks, i’ll check it out shortly
    Lucio Franco
    @LucioFranco
    :+1: im off to go get a haircut so no rush
    in my testing it seems to work though!
    John-John Tedro
    @udoprog

    So I'm trying to plug in TraceLogger into my application, and it seems like immediately when it tries to report the first span it blocks forever, probably some kind of deadlock. It's installed like this:

    let subscriber = tracing_log::TraceLogger::builder()
        .with_ids(true)
        .with_span_entry(true)
        .with_span_closes(true)
        .finish();
    
    tracing::subscriber::set_global_default(subscriber)?;

    In particular, I'm using it in combination with tracing-futures from git, so maybe that could be an issue. Anyone know what might be up?

    I'm guessing some kind of deadlock, but I'm unable to diagnose it right now cause I don't have a working debugger on this system.
    Gonna try it with a different logger as well, currently using log4rs and will try to switch to env_logger.
    John-John Tedro
    @udoprog
    Yeah, reproducible with env_logger as well. Just hangs when the first span is supposed to be reported.
    Lucio Franco
    @LucioFranco
    @udoprog do you have a small repro by chance?
    that seems really really odd
    John-John Tedro
    @udoprog
    Yeah, and found the deadlock. Will be opening an issue in a second.
    John-John Tedro
    @udoprog
    Described here: tokio-rs/tracing#369
    twissel
    @twissel
    twissel
    @twissel
    calling ctx.current_span(); causes span leak
    use futures::future::{self, Future};
    use tracing::{debug, info, span, Level};
    use tracing_futures::{Instrument, WithSubscriber};
    
    use tracing::*;
    use tracing_subscriber::layer::{Layer, Context};
    use tracing::span::Attributes;
    
    struct MyLayer;
    
    impl<S: Subscriber> Layer<S> for MyLayer {
        fn new_span(&self, attrs: &Attributes<'_>, created: &Id, ctx: Context<'_, S>) {
            let span = ctx.current_span();
            dbg!(created);
        }
    
        fn on_close(&self, dropped: Id, _ctx: Context<'_, S>) {
            dbg!(dropped);
        }
    }
    
    fn parent() -> impl Future<Item = (), Error = ()> {
        futures::lazy({ || {
            child()
        }}).and_then(|futures| {
            info!("and_then");
            Ok(())
        }).instrument(span!(Level::INFO, "parent_task"))
    }
    
    fn child() -> impl Future<Item = (), Error = ()> {
        futures::lazy(|| {
            info!("from child");
            Ok(())
        }).instrument(span!(Level::INFO, "child_task"))
    }
    
    fn main() {
        let subscriber = tracing_subscriber::fmt::Subscriber::default();
        let subscriber = Layer::with_subscriber(MyLayer, subscriber);
        tracing::subscriber::set_global_default(subscriber).expect("failed to set");
    
        tokio::run(parent());
    }
    David Barsky
    @davidbarsky
    @twissel you’ll get more responses in discord: https://discord.gg/Hgdhcp
    Emil Hammarström
    @eHammarstrom

    Hi, I was looking to take a stab at this issue: tokio-rs/tracing#201

    I am wondering if wrapping the statements of a test like so,
    https://github.com/eHammarstrom/tracing-proc-macros-test/blob/master/src/lib.rs#L11,
    is considered initializing a "scoped subscriber context" for that test. Herein is also a test using the attribute macro #[traced_test].

    The initial implementation can be found here, any feedback appreciated:
    https://github.com/eHammarstrom/tracing/blob/master/tracing-proc-macros/src/lib.rs

    David Barsky
    @davidbarsky
    @eHammarstrom i suggest clicking the discord link above; you’ll get better responses there.
    Christian Schilling
    @christian-schilling
    Hi, I am trying to migrate my project to use tracing after watching a talk by @hawkw yesterday. Unfortunately I can't get it to work :(
        tracing_log::LogTracer::init().expect("can't init LogTracer");
        let subscriber = tracing_subscriber::fmt::Subscriber::default();
        tracing::subscriber::set_global_default(subscriber).expect("failed to set");
    
        log::info!("A");
        log::debug!("B");
    Prints A but not B. I don't understand why. There are no filters so it should print everything. Or what am I missing?
    Also I can't get it to output anything originating from the other crates (I know my app produces lots of log events coming from tokio_core)
    Christian Schilling
    @christian-schilling
    Also, assuming I can get this working at some point: I have been using rs_tracing to produce output compatible with about://tracing in chrome. Is someone working on this for tracing as well? If not I will. Would it make sense to put is into tracing_subscriber or make a new crate?
    David Barsky
    @davidbarsky
    heya @initcrash we’re way more active in discord, but the the default settings filter at info, i believe
    Christian Schilling
    @christian-schilling
    The invite link above seems to be expired
    David Barsky
    @davidbarsky
    https://discord.gg/Nf2GP3V here’s an unlimited one
    Christian Schilling
    @christian-schilling
    thanks :)
    David Barsky
    @davidbarsky
    but the chrome tracing one—maybe a separate crate would be best, but building on the interface in tracing-subscriber
    (sorry, gitter is terrible on iOS 13, and i’m not at work yet.)
    @initcrash responded to your question in tracing-users on discord :)
    matrixbot
    @matrixbot
    an_zhuo Hi, I'm using tracing with async_std and noticed when I process a stream with for_each_concurrent that it creates multiple nested spans randomly
    an_zhuo Idk if I'm just doing something wrong or if that's a bug. Within for_each_concurrent I am calling task::spawn and then creating a span inside the async block
    an_zhuo It's only one span, and the block is pretty short
    an_zhuo But the log ends up with nested spans like span_name:{something}:span_name:{somethingelse}:span_name:{different thing}
    an_zhuo Any idea what could be going on?
    matrixbot
    @matrixbot

    Ralith > <@anzhuo:matrix.org> Any idea what could be going on?

    yeah, for async code you need to use tracing-futures' Instrument extension trait

    Ralith the RAII guards have no way to know they're in an async context, so they can't properly enter/exit the span on every poll, leading to the behavior you observed

    an_zhuo > <@ralith:ralith.com> the RAII guards have no way to know they're in an async context, so they can't properly enter/exit the span on every poll, leading to the behavior you observed

    Thank you so much! I will try that.

    matrixbot
    @matrixbot
    Ralith np, good luck!
    Johannes Lundberg
    @johalun
    Hi! How can I filter on one or more targets?
    matrixbot
    @matrixbot
    Ralith the envlogger subscriber works the same way the envlogger crate does
    Felipe Lessa
    @meteficha
    Hello, all! What's the best way of initializing tracing_subscriber::fmt inside tests? Should I simply try to initialize it while ignoring failures on every test? E.g.:
      #[test]
      fn foo() {
        let _ = tracing_subscriber::fmt::try_init();
        ...
      }
    (we’re also not active here. we’re on discord: https://discord.gg/ArWJn2F)
    Felipe Lessa
    @meteficha
    Cool, thanks, @davidbarsky (:
    Luis Wirth
    @LU15W1R7H
    Hi, I've got a question:
    Is there an existing way to write the output of tracing to a file. Or can I integrate tracing with the fern crate, which already provides such functionality?
    Ralith discord's more active
    Luis Wirth
    @LU15W1R7H
    thanks x2
    sarvi
    @sarvi
    I am building a LD_Preload Library in RUST ad want to enable tracing for LD_PRELOAD Library. I had added tracing package and turned "log-always" feature in Cargo.toml and have istrumented the code with with both event!(Level::INFO, "linkat(...)"); and a println but dont the event only the println
    not the event