From d3b51c2c6eec39d1ff814bb47a41e4c96d3c9c13 Mon Sep 17 00:00:00 2001 From: Oliver Newland Date: Tue, 7 Apr 2026 15:05:55 -0700 Subject: [PATCH] feat(consumer): Emit batch_write_bytes metric from RowBinary writer The RowBinary writer was missing the insertions.batch_write_bytes counter that the JSONEachRow writer already emits. Adding it here so we can observe batch byte sizes across all eap_items consumers (s4s2/de use RowBinary) as part of Phase 0 of the byte-based batching rollout. Refs EAP-460 Co-Authored-By: Claude Opus 4.6 (1M context) --- rust_snuba/src/strategies/clickhouse/row_binary_writer.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rust_snuba/src/strategies/clickhouse/row_binary_writer.rs b/rust_snuba/src/strategies/clickhouse/row_binary_writer.rs index 01221ee619..35c00b32c3 100644 --- a/rust_snuba/src/strategies/clickhouse/row_binary_writer.rs +++ b/rust_snuba/src/strategies/clickhouse/row_binary_writer.rs @@ -79,6 +79,7 @@ where Box::pin(async move { let (empty_message, insert_batch) = message.take(); let batch_len = insert_batch.len(); + let num_bytes = insert_batch.num_bytes(); let (rows, empty_batch) = insert_batch.take(); let write_start = SystemTime::now(); @@ -126,6 +127,7 @@ where } } + counter!("insertions.batch_write_bytes", num_bytes as i64); counter!("insertions.batch_write_msgs", batch_len as i64); empty_batch.record_message_latency(); empty_batch.emit_item_type_metrics();