Skip to content

Commit e18554b

Browse files
committed
Update batch metrics after posting
1 parent 6487615 commit e18554b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

crates/batcher/src/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,6 +1500,20 @@ impl Batcher {
15001500
finalized_batch.len()
15011501
);
15021502

1503+
// Update queue metrics after successful batch extraction
1504+
let queue_len = batch_state_lock.batch_queue.len();
1505+
match calculate_batch_size(&batch_state_lock.batch_queue) {
1506+
Ok(queue_size_bytes) => {
1507+
self.metrics
1508+
.update_queue_metrics(queue_len as i64, queue_size_bytes as i64);
1509+
}
1510+
Err(e) => {
1511+
error!("Failed to calculate batch size for queue metrics update: {:?}", e);
1512+
// Still update queue length metric, set size to 0 due to calculation error
1513+
self.metrics.update_queue_metrics(queue_len as i64, 0);
1514+
}
1515+
}
1516+
15031517
Some(finalized_batch)
15041518
}
15051519

0 commit comments

Comments
 (0)