From 5db56343eab9661d33d98de8f6c0ad0acef6a7fa Mon Sep 17 00:00:00 2001 From: "Brian L. Troutwine" Date: Fri, 13 Dec 2024 16:25:36 -0800 Subject: [PATCH] allow expiry configuration at CLI Signed-off-by: Brian L. Troutwine --- lading/src/bin/lading.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lading/src/bin/lading.rs b/lading/src/bin/lading.rs index 8cb0af662b..e86c7cfa5c 100644 --- a/lading/src/bin/lading.rs +++ b/lading/src/bin/lading.rs @@ -11,7 +11,7 @@ use clap::{ArgGroup, Parser, Subcommand}; use lading::{ blackhole, captures::CaptureManager, - config::{default_expiration, Config, Telemetry}, + config::{Config, Telemetry}, generator::{self, process_tree}, inspector, observer, target::{self, Behavior, Output}, @@ -181,6 +181,9 @@ struct Opts { /// prometheus-addr #[clap(long)] capture_path: Option, + /// time that capture metrics will expire by if they are not seen again, only useful when capture-path is set + #[clap(long)] + capture_expiriation_seconds: Option, /// address to bind prometheus exporter to, exclusive of prometheus-path and /// promtheus-addr #[clap(long)] @@ -301,7 +304,7 @@ fn get_config(ops: &Opts, config: Option) -> Result { config.telemetry = Telemetry::Log { path: capture_path.parse().map_err(|_| Error::CapturePath)?, global_labels: options_global_labels.inner, - expiration: default_expiration(), + expiration: Duration::from_secs(ops.capture_expiriation_seconds.unwrap_or(u64::MAX)), }; } else { match config.telemetry {