Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more information to lost_bytes telemetry #1094

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lading/src/generator/file_gen/logrotate_fs/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -661,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)
Expand Down Expand Up @@ -731,8 +733,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);
}
}
}
Expand Down
Loading