Skip to content

Commit 13a59b5

Browse files
authored
feat(eap): emit item type counts (#7548)
Emit how many events by type are being processed by the EAP consumer. This is being split into 3 changes: - change how we build BytesInsertBatch to support a builder pattern (so it's more simple to omit dataset-specific fields): #7479 (merged) - start keeping track of how many items by type are being processed in the EAPItems processor: #7481 - (this change) emit the actual metric at the end of a batch write
1 parent 3641ddf commit 13a59b5

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

rust_snuba/src/strategies/clickhouse/writer_v2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ fn clickhouse_task_runner(
6262
counter!("insertions.batch_write_bytes", num_bytes as i64);
6363
counter!("insertions.batch_write_msgs", batch_len as i64);
6464
empty_batch.record_message_latency();
65+
empty_batch.emit_item_type_metrics();
6566

6667
Ok(empty_message.replace(empty_batch))
6768
})

rust_snuba/src/types.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,18 @@ impl<R> BytesInsertBatch<R> {
360360
self.sentry_received_timestamp
361361
.send_metric(write_time, "sentry_received_latency");
362362
}
363+
364+
pub fn emit_item_type_metrics(&self) {
365+
use sentry_arroyo::counter;
366+
367+
for (item_type, count) in &self.item_type_metrics.counts {
368+
counter!(
369+
"insertions.item_type_count",
370+
*count as i64,
371+
"item_type" => item_type.to_string()
372+
);
373+
}
374+
}
363375
}
364376

365377
impl BytesInsertBatch<RowData> {

0 commit comments

Comments
 (0)