Skip to content

Commit

Permalink
measure how many changes get dropped
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegn authored and somtochiama committed Nov 29, 2024
1 parent 9dacb40 commit c31d2a1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/corro-agent/src/agent/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,7 @@ pub async fn handle_changes(

// drop old items when the queue is full.
if queue.len() >= max_queue_len {
let mut dropped_count = 0;
if let Some((dropped_change, _, _)) = queue.pop_front() {
for v in dropped_change.versions() {
if let Entry::Occupied(mut entry) = seen.entry((change.actor_id, v)) {
Expand All @@ -900,7 +901,9 @@ pub async fn handle_changes(
}

buf_cost -= dropped_change.processing_cost();
dropped_count += 1;
}
counter!("corro.agent.changes.dropped").increment(dropped_count);

log_at_pow_10("dropped old change from queue", &mut drop_log_count);
}
Expand Down

0 comments on commit c31d2a1

Please sign in to comment.