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