Skip to content

Commit

Permalink
emit total bytes loss logs
Browse files Browse the repository at this point in the history
Signed-off-by: Brian L. Troutwine <brian.troutwine@datadoghq.com>
  • Loading branch information
blt committed Oct 28, 2024
1 parent 05f4d16 commit 0d48b33
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lading/src/generator/file_gen/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::collections::{HashMap, HashSet};
use bytes::Bytes;
use lading_payload::block;
use rand::Rng;
use tracing::info;

/// Time representation of the model
pub type Tick = u64;
Expand Down Expand Up @@ -675,6 +676,7 @@ impl State {

// Garbage collect unlinked files with no open handles, calculating the bytes
// lost from these files.
#[tracing::instrument(skip(self))]
fn gc(&mut self) {
let mut to_remove = Vec::new();
for (&inode, node) in &self.nodes {
Expand All @@ -688,6 +690,7 @@ impl State {
if let Some(Node::File { file }) = self.nodes.remove(&inode) {
let lost_bytes = file.bytes_written.saturating_sub(file.bytes_read);
self.lost_bytes += lost_bytes;
info!("TOTAL BYTES LOST: {lost}", lost = self.lost_bytes);
}
}
}
Expand Down

0 comments on commit 0d48b33

Please sign in to comment.