From dc4aaf7bfe305dcc8761b45f5f623b975b22b439 Mon Sep 17 00:00:00 2001 From: "Brian L. Troutwine" Date: Tue, 5 Nov 2024 17:31:04 -0800 Subject: [PATCH 1/2] Add more information to lost_bytes telemetry This commit adds more information to the lost_bytes telemetry, intention being to make it easier to debug under what conditions bytes are lost. REF SMPTNG-517 Signed-off-by: Brian L. Troutwine --- lading/src/generator/file_gen/logrotate_fs/model.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lading/src/generator/file_gen/logrotate_fs/model.rs b/lading/src/generator/file_gen/logrotate_fs/model.rs index dd2273c24..8811af288 100644 --- a/lading/src/generator/file_gen/logrotate_fs/model.rs +++ b/lading/src/generator/file_gen/logrotate_fs/model.rs @@ -6,6 +6,7 @@ use metrics::counter; use rand::Rng; use rustc_hash::FxHashMap; use std::collections::BTreeSet; +use tracing::info; /// Time representation of the model pub(crate) type Tick = u64; @@ -731,8 +732,14 @@ impl State { for inode in to_remove { if let Some(Node::File { file }) = self.nodes.remove(&inode) { let lost_bytes = file.bytes_written.saturating_sub(file.max_offset_observed); + info!("Log file deleted. Total bytes lost: {lost_bytes}. Total bytes written: {bytes_written}. Total bytes read: {bytes_read}. Group ID: {group_id}. Created: {created_tick}.", + group_id = file.group_id, + created_tick = file.created_tick, + bytes_written = file.bytes_written, + bytes_read = file.bytes_read); counter!("log_file_deleted").increment(1); - counter!("lost_bytes").increment(lost_bytes); + counter!("lost_bytes", "group_id" => format!("{}", file.group_id)) + .increment(lost_bytes); } } } From 0126d8bf5c88bdffad69475ad5ceafee92fe1b39 Mon Sep 17 00:00:00 2001 From: "Brian L. Troutwine" Date: Tue, 5 Nov 2024 17:34:10 -0800 Subject: [PATCH 2/2] add more telemetry to log_file_rotated Signed-off-by: Brian L. Troutwine --- lading/src/generator/file_gen/logrotate_fs/model.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lading/src/generator/file_gen/logrotate_fs/model.rs b/lading/src/generator/file_gen/logrotate_fs/model.rs index 8811af288..9e8c1fe69 100644 --- a/lading/src/generator/file_gen/logrotate_fs/model.rs +++ b/lading/src/generator/file_gen/logrotate_fs/model.rs @@ -662,7 +662,8 @@ impl State { let (remove_current, next_peer) = match node { Node::File { file } => { file.incr_ordinal(); - counter!("log_file_rotated").increment(1); + counter!("log_file_rotated", "group_id" => format!("{}", file.group_id)) + .increment(1); let remove_current = file.ordinal() > self.max_rotations; (remove_current, file.peer)