Skip to content

Commit 46f10c1

Browse files
authored
add optional tracing to tpch, enable async trace style (#2540)
1 parent 2bedbef commit 46f10c1

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

bench-vortex/src/bin/clickbench.rs

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ fn main() {
6464

6565
let (layer, _guard) = tracing_chrome::ChromeLayerBuilder::new()
6666
.include_args(true)
67+
.trace_style(tracing_chrome::TraceStyle::Async)
6768
.file("clickbench.trace.json")
6869
.build();
6970

bench-vortex/src/bin/tpch.rs

+27-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use bench_vortex::tpch::{
1010
EXPECTED_ROW_COUNTS_SF1, EXPECTED_ROW_COUNTS_SF10, TPC_H_ROW_COUNT_ARRAY_LENGTH, load_datasets,
1111
run_tpch_query, tpch_queries,
1212
};
13-
use bench_vortex::{Format, default_env_filter, feature_flagged_allocator, setup_logger};
13+
use bench_vortex::{Format, default_env_filter, feature_flagged_allocator};
1414
use clap::{Parser, ValueEnum};
1515
use datafusion_physical_plan::metrics::{Label, MetricsSet};
1616
use indicatif::ProgressBar;
@@ -68,7 +68,32 @@ fn main() -> ExitCode {
6868
let args = Args::parse();
6969

7070
let filter = default_env_filter(args.verbose);
71-
setup_logger(filter);
71+
#[cfg(not(feature = "tracing"))]
72+
bench_vortex::setup_logger(filter);
73+
74+
// We need the guard to live to the end of the function, so can't create it in the if-block
75+
#[cfg(feature = "tracing")]
76+
let _trace_guard = {
77+
use tracing_subscriber::prelude::*;
78+
79+
let (layer, _guard) = tracing_chrome::ChromeLayerBuilder::new()
80+
.include_args(true)
81+
.trace_style(tracing_chrome::TraceStyle::Async)
82+
.file("tpch.trace.json")
83+
.build();
84+
85+
let fmt_layer = tracing_subscriber::fmt::layer()
86+
.with_writer(std::io::stderr)
87+
.with_level(true)
88+
.with_line_number(true);
89+
90+
tracing_subscriber::registry()
91+
.with(filter)
92+
.with(layer)
93+
.with(fmt_layer)
94+
.init();
95+
_guard
96+
};
7297

7398
if args.only_vortex {
7499
panic!("use `--formats vortex,arrow` instead of `--only-vortex`");

0 commit comments

Comments
 (0)