tracing-callgraph 0.1.0-alpha.1

A tracing library for generating call graphs from spans.
Documentation
use tracing_callgraph::GraphLayer;
use tracing_subscriber::{prelude::*, registry::Registry};

fn setup_global_subscriber() -> impl Drop {
    let (mut graph_layer, _guard) = GraphLayer::with_file("./output.dot").unwrap();
    graph_layer = graph_layer.enable_top_node("top node");
    let subscriber = Registry::default().with(graph_layer);

    tracing::subscriber::set_global_default(subscriber).expect("Could not set global default");
    _guard
}

#[tracing::instrument]
fn outer_a() {
    inner()
}

#[tracing::instrument]
fn outer_b() {
    inner()
}

#[tracing::instrument]
fn inner() {}

fn main() {
    let _guard = setup_global_subscriber();
    outer_a();
    outer_a();
    outer_a();
    outer_b();
}