vector/internal_events/
internal_logs.rs

1use metrics::counter;
2use vector_lib::internal_event::InternalEvent;
3use vector_lib::json_size::JsonSize;
4
5#[derive(Debug)]
6pub struct InternalLogsBytesReceived {
7    pub byte_size: usize,
8}
9
10impl InternalEvent for InternalLogsBytesReceived {
11    fn emit(self) {
12        // MUST NOT emit logs here to avoid an infinite log loop
13        counter!(
14            "component_received_bytes_total",
15            "protocol" => "internal",
16        )
17        .increment(self.byte_size as u64);
18    }
19}
20
21#[derive(Debug)]
22pub struct InternalLogsEventsReceived {
23    pub byte_size: JsonSize,
24    pub count: usize,
25}
26
27impl InternalEvent for InternalLogsEventsReceived {
28    fn emit(self) {
29        // MUST NOT emit logs here to avoid an infinite log loop
30        counter!("component_received_events_total").increment(self.count as u64);
31        counter!("component_received_event_bytes_total").increment(self.byte_size.get() as u64);
32    }
33}