forked from vectordotdev/vector
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinternal_logs.rs
More file actions
32 lines (28 loc) · 973 Bytes
/
internal_logs.rs
File metadata and controls
32 lines (28 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use metrics::counter;
use vector_lib::{NamedInternalEvent, internal_event::InternalEvent, json_size::JsonSize};
#[derive(Debug, NamedInternalEvent)]
pub struct InternalLogsBytesReceived {
pub byte_size: usize,
}
impl InternalEvent for InternalLogsBytesReceived {
fn emit(self) {
// MUST NOT emit logs here to avoid an infinite log loop
counter!(
"component_received_bytes_total",
"protocol" => "internal",
)
.increment(self.byte_size as u64);
}
}
#[derive(Debug, NamedInternalEvent)]
pub struct InternalLogsEventsReceived {
pub byte_size: JsonSize,
pub count: usize,
}
impl InternalEvent for InternalLogsEventsReceived {
fn emit(self) {
// MUST NOT emit logs here to avoid an infinite log loop
counter!("component_received_events_total").increment(self.count as u64);
counter!("component_received_event_bytes_total").increment(self.byte_size.get() as u64);
}
}