vector_common/internal_event/
events_received.rs1use metrics::{counter, histogram, Counter, Histogram};
2use tracing::trace;
3
4use super::CountByteSize;
5
6crate::registered_event!(
7 EventsReceived => {
8 events_count: Histogram = histogram!("component_received_events_count"),
9 events: Counter = counter!("component_received_events_total"),
10 event_bytes: Counter = counter!("component_received_event_bytes_total"),
11 }
12
13 fn emit(&self, data: CountByteSize) {
14 let CountByteSize(count, byte_size) = data;
15
16 trace!(message = "Events received.", count = %count, byte_size = %byte_size);
17
18 #[allow(clippy::cast_precision_loss)]
19 self.events_count.record(count as f64);
20 self.events.increment(count as u64);
21 self.event_bytes.increment(byte_size.get() as u64);
22 }
23);