Skip to content

Commit

Permalink
Support warmup period
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeHahn committed Dec 2, 2024
1 parent fef9151 commit 8e0b357
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lading/src/bin/captool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ struct Args {
#[clap(short, long)]
dump_values: bool,

/// Path to line-delimited capture file
/// path to line-delimited capture file
capture_path: String,

/// warmup period in seconds - data points before this time will be ignored
#[clap(long)]
warmup: Option<u64>,
}

#[derive(thiserror::Error, Debug)]
Expand Down Expand Up @@ -117,6 +121,13 @@ async fn main() -> Result<(), Error> {
// Use a BTreeSet to ensure that the tags are sorted
let filtered: Vec<_> = lines
.filter(|line| &line.metric_name == metric)
.filter(|line| {
if let Some(warmup) = args.warmup {
line.fetch_index >= warmup
} else {
true
}
})
.collect()
.await;

Expand Down

0 comments on commit 8e0b357

Please sign in to comment.