[−][src]Crate reqray
Log "request x-rays" for rust programs instrumented with tracing. This includes aggregated wall/own times as frequently found in flame graphs in a human-friendly text format.
Let's assume that you already have an explicit setup for tracing
like this, then you simply
need to add the highlighted line:
use reqray::CallTreeCollector; use tracing_subscriber::{EnvFilter, util::SubscriberInitExt, fmt, prelude::*}; let fmt_layer = fmt::layer() .with_target(false); let filter_layer = EnvFilter::try_from_default_env() .or_else(|_| EnvFilter::try_new("info")) .unwrap(); tracing_subscriber::registry() // ----------------------------------------------- .with(CallTreeCollector::default()) // ----------------------------------------------- .with(filter_layer) .with(fmt_layer) .init();
Instead of CallTreeCollector::default()
you can chose a more explicit config:
// ... let call_tree_collector = CallTreeCollectorBuilder::default() .max_call_depth(10) .build_with_collector( LoggingCallTreeCollectorBuilder::default() .left_margin(20) .build(), ); tracing_subscriber::registry() .with(call_tree_collector) // ...
Modules
display |
Structs
CallPathPool | |
CallPathPoolId | |
CallPathTiming | A CallPathTiming is an aggregation of all spans with the same
call path. That means that their |
CallTreeCollector | A tracing::Subscriber which collects call trees and hands finished trees to a FinishedCallTreeProcessor. |
CallTreeCollectorBuilder | Configure & Build CallTreeCollectors. |
Traits
FinishedCallTreeProcessor | A FinishedCallTreeProcessor uses the aggregated call tree for something useful. |