Skip to content

Commit

Permalink
allow expiry configuration at CLI
Browse files Browse the repository at this point in the history
Signed-off-by: Brian L. Troutwine <brian.troutwine@datadoghq.com>
  • Loading branch information
blt committed Dec 14, 2024
1 parent c927bac commit 5db5634
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lading/src/bin/lading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -181,6 +181,9 @@ struct Opts {
/// prometheus-addr
#[clap(long)]
capture_path: Option<String>,
/// 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<u64>,
/// address to bind prometheus exporter to, exclusive of prometheus-path and
/// promtheus-addr
#[clap(long)]
Expand Down Expand Up @@ -301,7 +304,7 @@ fn get_config(ops: &Opts, config: Option<String>) -> Result<Config, Error> {
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 {
Expand Down

0 comments on commit 5db5634

Please sign in to comment.