Giter Site home page Giter Site logo

Structured Logging about rune HOT 1 OPEN

Michael-F-Bryan avatar Michael-F-Bryan commented on August 21, 2024
Structured Logging

from rune.

Comments (1)

Michael-F-Bryan avatar Michael-F-Bryan commented on August 21, 2024

At the moment we generate a pipeline lambda like this:

let pipeline = move || {
    let _guard = hotg_runicos_base_wasm::PipelineGuard::default();
    log::debug!("Reading data from \"audio\"");
    let audio_0: Tensor<i16> = audio.generate();
    log::debug!("Executing \"fft\"");
    let fft_0: Tensor<u32> = fft.transform(audio_0.clone());
    log::debug!("Executing \"noise_filtering\"");
    let noise_filtering_0: Tensor<i8> = noise_filtering.transform(fft_0.clone());
    log::debug!("Executing \"model\"");
    let model_0: Tensor<i8> = model.transform(noise_filtering_0.clone());
    log::debug!("Executing \"most_confident\"");
    let most_confident_0: Tensor<u32> = most_confident.transform(model_0.clone());
    log::debug!("Executing \"label\"");
    let label_0: Tensor<alloc::borrow::Cow<'static, str>> =
        label.transform(most_confident_0.clone());
    log::debug!("Sending results to the \"serial\" output");
    serial.consume(label_0.clone());
};

Switching to structured logging would mean we generate this:

let pipeline = move || {
    let pipeline_span = tracing::span!(target: "pipeline").entered();

    let span = tracing::span!(target: "stage", Level::INFO, name = "audio", node_type = "capability").entered();
    let audio_0: Tensor<i16> = audio.generate();
    drop(span);

    let span = tracing::span!(target: "stage", Level::INFO, name = "fft", node_type = "proc-block").entered();
    let fft_0: Tensor<u32> = fft.transform(audio_0.clone());
    drop(span);

    let span = tracing::span!(target: "stage", Level::INFO, name = "noise_filtering", node_type = "proc-block").entered();
    let noise_filtering_0: Tensor<i8> = noise_filtering.transform(fft_0.clone());
    drop(span);

    let span = tracing::span!(target: "stage", Level::INFO, name = "model", node_type = "model").entered();
    let model_0: Tensor<i8> = model.transform(noise_filtering_0.clone());
    drop(span);

    let span = tracing::span!(target: "stage", Level::INFO, name = "most_confident", node_type = "proc-block").entered();
    let most_confident_0: Tensor<u32> = most_confident.transform(model_0.clone());
    drop(span);

    let span = tracing::span!(target: "stage", Level::INFO, name = "label", node_type = "proc-block").entered();
    let label_0: Tensor<alloc::borrow::Cow<'static, str>> = label.transform(most_confident_0.clone());
    drop(span);

    let span = tracing::span!(target: "stage", Level::INFO, name = "serial", node_type = "out").entered();
    serial.consume(label_0.clone());
    drop(span);
};

Note: We are notified whenever we enter/exit a Span, so that can be used to derive timing information.

from rune.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.