Skip to content

Commit bc5ac2d

Browse files
authored
fix: Replace long running span with short lived spans (#46)
* fix: Replace long running span with short lived spans * 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 * chore: Update changelog
1 parent 049be36 commit bc5ac2d

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@ All notable changes to this project will be documented in this file.
77
### Changed
88

99
- Increased the default `--loop` interval from every minute to every 30 minutes ([#23]).
10-
- Collect and output the open files limit ([#45])
10+
- Collect and output the open files limit ([#45]).
11+
12+
### Fixes
13+
14+
- Move the span inside the loop ([#46]).
1115

1216
[#23]: https://github.com/stackabletech/containerdebug/pull/23
1317
[#45]: https://github.com/stackabletech/containerdebug/pull/45
18+
[#46]: https://github.com/stackabletech/containerdebug/pull/46
1419

1520
## [0.1.1] - 2024-12-16
1621

src/main.rs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mod error;
22
mod system_information;
33

4-
use clap::{Parser, crate_description, crate_version};
4+
use clap::Parser;
55
use stackable_operator::telemetry::Tracing;
66
use std::path::PathBuf;
77

@@ -43,22 +43,27 @@ fn main() {
4343
.init()
4444
.unwrap();
4545

46-
// Wrap *all* output in a span, to separate it from main app output.
47-
let _span = tracing::error_span!("containerdebug").entered();
46+
let init_span = tracing::error_span!("containerdebug init").entered();
4847

49-
stackable_operator::utils::print_startup_string(
50-
crate_description!(),
51-
crate_version!(),
52-
built_info::GIT_VERSION,
53-
built_info::TARGET,
54-
built_info::BUILT_TIME_UTC,
55-
built_info::RUSTC_VERSION,
48+
tracing::info!(
49+
built_info.pkg_version = built_info::PKG_VERSION,
50+
built_info.git_version = built_info::GIT_VERSION,
51+
built_info.target = built_info::TARGET,
52+
built_info.built_time_utc = built_info::BUILT_TIME_UTC,
53+
built_info.rustc_version = built_info::RUSTC_VERSION,
54+
"Starting {name}",
55+
name = built_info::PKG_NAME
5656
);
5757

5858
let mut collect_ctx = SystemInformation::init();
5959

6060
let mut next_run = Instant::now();
61+
62+
drop(init_span);
6163
loop {
64+
// Wrap *all* output in a span, to separate it from main app output.
65+
let _span = tracing::error_span!("containerdebug run").entered();
66+
6267
let next_run_sleep = next_run.saturating_duration_since(Instant::now());
6368
if !next_run_sleep.is_zero() {
6469
tracing::info!(?next_run, "scheduling next run...");

0 commit comments

Comments
 (0)