diff --git a/CHANGELOG.md b/CHANGELOG.md index 79885b0..23e2b75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,15 @@ All notable changes to this project will be documented in this file. ### Changed - Increased the default `--loop` interval from every minute to every 30 minutes ([#23]). -- Collect and output the open files limit ([#45]) +- Collect and output the open files limit ([#45]). + +### Fixes + +- Move the span inside the loop ([#46]). [#23]: https://github.com/stackabletech/containerdebug/pull/23 [#45]: https://github.com/stackabletech/containerdebug/pull/45 +[#46]: https://github.com/stackabletech/containerdebug/pull/46 ## [0.1.1] - 2024-12-16 diff --git a/src/main.rs b/src/main.rs index 8b99b75..5c58aaa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ mod error; mod system_information; -use clap::{Parser, crate_description, crate_version}; +use clap::Parser; use stackable_operator::telemetry::Tracing; use std::path::PathBuf; @@ -43,22 +43,27 @@ fn main() { .init() .unwrap(); - // Wrap *all* output in a span, to separate it from main app output. - let _span = tracing::error_span!("containerdebug").entered(); + let init_span = tracing::error_span!("containerdebug init").entered(); - stackable_operator::utils::print_startup_string( - crate_description!(), - crate_version!(), - built_info::GIT_VERSION, - built_info::TARGET, - built_info::BUILT_TIME_UTC, - built_info::RUSTC_VERSION, + tracing::info!( + built_info.pkg_version = built_info::PKG_VERSION, + built_info.git_version = built_info::GIT_VERSION, + built_info.target = built_info::TARGET, + built_info.built_time_utc = built_info::BUILT_TIME_UTC, + built_info.rustc_version = built_info::RUSTC_VERSION, + "Starting {name}", + name = built_info::PKG_NAME ); let mut collect_ctx = SystemInformation::init(); let mut next_run = Instant::now(); + + drop(init_span); loop { + // Wrap *all* output in a span, to separate it from main app output. + let _span = tracing::error_span!("containerdebug run").entered(); + let next_run_sleep = next_run.saturating_duration_since(Instant::now()); if !next_run_sleep.is_zero() { tracing::info!(?next_run, "scheduling next run...");