From 8cb82e92a971b6d6b7488198ec143eedcc03b717 Mon Sep 17 00:00:00 2001 From: Nick Larsen Date: Fri, 23 May 2025 10:59:13 +0200 Subject: [PATCH 1/3] fix: Replace long running span with short lived spans --- src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 8b99b75..105bab4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -43,8 +43,7 @@ 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!(), @@ -58,7 +57,12 @@ fn main() { 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..."); From 12d88e4761a56fe60a46eff05aab89777a76b911 Mon Sep 17 00:00:00 2001 From: Nick Larsen Date: Fri, 23 May 2025 18:33:42 +0200 Subject: [PATCH 2/3] chore: replace print_startup_string with print_startup_string Note: this has the added benefit of displaying the correct tracing target (or call-site), instead of displaying stackable_operator --- src/main.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index 105bab4..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; @@ -45,13 +45,14 @@ fn main() { 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(); From ea69148883852d6cf858941f11caa1cd984c9596 Mon Sep 17 00:00:00 2001 From: Nick Larsen Date: Fri, 23 May 2025 18:44:18 +0200 Subject: [PATCH 3/3] chore: Update changelog --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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