From a7f9d9baddb5a7f5cbc2c4c2c71d298206511ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natalie=20Klestrup=20R=C3=B6ijezon?= Date: Mon, 16 Dec 2024 12:23:33 +0100 Subject: [PATCH 1/2] Wrap all output in a containerdebug span (#18) * Wrap all output in a containerdebug span * Changelog --- CHANGELOG.md | 6 ++++++ src/main.rs | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b4b9b8..f199757 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Changed + +- All output is now wrapped in a "containerdebug" span ([#18]). + +[#18]: https://github.com/stackabletech/containerdebug/pull/18 + ## [0.1.0] - 2024-12-09 ### Added diff --git a/src/main.rs b/src/main.rs index cd142e0..c2fc08d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -42,6 +42,10 @@ fn main() { APP_NAME, opts.tracing_target, ); + + // Wrap *all* output in a span, to separate it from main app output. + let _span = tracing::error_span!("containerdebug").entered(); + stackable_operator::utils::print_startup_string( crate_description!(), crate_version!(), @@ -62,7 +66,6 @@ fn main() { let system_information = SystemInformation::collect(); let serialized = serde_json::to_string_pretty(&system_information).unwrap(); - // println!("{serialized}"); if let Some(output_path) = &opts.output { std::fs::write(output_path, &serialized).unwrap(); } From 9875895c7247398f2578ba6ff304f35f0b6b1c88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Natalie=20Klestrup=20R=C3=B6ijezon?= Date: Mon, 16 Dec 2024 12:58:26 +0100 Subject: [PATCH 2/2] Downgrade DNS errors to warnings (#17) * Downgrade DNS errors to warnings * Changelog --- CHANGELOG.md | 2 ++ src/system_information/network.rs | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f199757..f44b1ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,10 @@ All notable changes to this project will be documented in this file. ### Changed +- Downgraded DNS errors to warnings ([#17]). - All output is now wrapped in a "containerdebug" span ([#18]). +[#17]: https://github.com/stackabletech/containerdebug/pull/17 [#18]: https://github.com/stackabletech/containerdebug/pull/18 ## [0.1.0] - 2024-12-09 diff --git a/src/system_information/network.rs b/src/system_information/network.rs index 5b8ef68..c5d9904 100644 --- a/src/system_information/network.rs +++ b/src/system_information/network.rs @@ -67,14 +67,14 @@ impl SystemNetworkInfo { .into_iter() .map(|ptr_record| ptr_record.to_utf8()) .collect(); - tracing::info!(%ip, ?hostnames, "performed reverse lookup for IP"); + tracing::info!(%ip, ?hostnames, "performed reverse DNS lookup for IP"); Some((ip, hostnames)) } Err(error) => { - tracing::error!( + tracing::warn!( %ip, error = &error as &dyn std::error::Error, - "reverse lookup failed" + "reverse DNS lookup failed" ); None } @@ -89,14 +89,14 @@ impl SystemNetworkInfo { .filter_map(|hostname| match resolver.lookup_ip(hostname.clone()) { Ok(result) => { let ips = result.iter().collect(); - tracing::info!(hostname, ?ips, "performed forward lookup for hostname"); + tracing::info!(hostname, ?ips, "performed forward DNS lookup for hostname"); Some((hostname, ips)) } Err(error) => { - tracing::error!( + tracing::warn!( hostname, error = &error as &dyn std::error::Error, - "forward lookup failed" + "forward DNS lookup failed" ); None }