vector/internal_events/
host_metrics.rs1use metrics::counter;
2use vector_lib::internal_event::{InternalEvent, error_stage, error_type};
3
4#[derive(Debug)]
5pub struct HostMetricsScrapeError {
6 pub message: &'static str,
7}
8
9impl InternalEvent for HostMetricsScrapeError {
10 fn emit(self) {
11 error!(
12 message = self.message,
13 error_type = error_type::READER_FAILED,
14 stage = error_stage::RECEIVING,
15 internal_log_rate_limit = true,
16 );
17
18 counter!(
19 "component_errors_total",
20 "error_type" => error_type::READER_FAILED,
21 "stage" => error_stage::RECEIVING,
22 )
23 .increment(1);
24 }
25}
26
27#[derive(Debug)]
28pub struct HostMetricsScrapeDetailError<E> {
29 pub message: &'static str,
30 pub error: E,
31}
32
33impl<E: std::fmt::Display> InternalEvent for HostMetricsScrapeDetailError<E> {
34 fn emit(self) {
35 error!(
36 message = self.message,
37 error = %self.error,
38 error_type = error_type::READER_FAILED,
39 stage = error_stage::RECEIVING,
40 internal_log_rate_limit = true,
41 );
42
43 counter!(
44 "component_errors_total",
45 "error_type" => error_type::READER_FAILED,
46 "stage" => error_stage::RECEIVING,
47 )
48 .increment(1);
49 }
50}
51
52#[derive(Debug)]
53pub struct HostMetricsScrapeFilesystemError {
54 pub message: &'static str,
55 pub error: heim::Error,
56 pub mount_point: String,
57}
58
59impl InternalEvent for HostMetricsScrapeFilesystemError {
60 fn emit(self) {
61 error!(
62 message = self.message,
63 mount_point = self.mount_point,
64 error = %self.error,
65 error_type = error_type::READER_FAILED,
66 stage = error_stage::RECEIVING,
67 internal_log_rate_limit = true,
68 );
69
70 counter!(
71 "component_errors_total",
72 "error_type" => error_type::READER_FAILED,
73 "stage" => error_stage::RECEIVING,
74 )
75 .increment(1);
76 }
77}