forked from vectordotdev/vector
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogplex.rs
More file actions
47 lines (42 loc) · 1.3 KB
/
logplex.rs
File metadata and controls
47 lines (42 loc) · 1.3 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use metrics::counter;
use vector_lib::NamedInternalEvent;
use vector_lib::internal_event::{InternalEvent, error_stage, error_type};
use super::prelude::io_error_code;
#[derive(Debug, NamedInternalEvent)]
pub struct HerokuLogplexRequestReceived<'a> {
pub msg_count: usize,
pub frame_id: &'a str,
pub drain_token: &'a str,
}
impl InternalEvent for HerokuLogplexRequestReceived<'_> {
fn emit(self) {
debug!(
message = "Handling logplex request.",
msg_count = %self.msg_count,
frame_id = %self.frame_id,
drain_token = %self.drain_token
);
}
}
#[derive(Debug, NamedInternalEvent)]
pub struct HerokuLogplexRequestReadError {
pub error: std::io::Error,
}
impl InternalEvent for HerokuLogplexRequestReadError {
fn emit(self) {
error!(
message = "Error reading request body.",
error = ?self.error,
error_type = error_type::READER_FAILED,
error_code = io_error_code(&self.error),
stage = error_stage::PROCESSING,
);
counter!(
"component_errors_total",
"error_type" => error_type::READER_FAILED,
"error_code" => io_error_code(&self.error),
"stage" => error_stage::PROCESSING,
)
.increment(1);
}
}