vector/internal_events/
process.rs1use metrics::counter;
2use vector_lib::internal_event::{InternalEvent, error_stage, error_type};
3
4use crate::{built_info, config};
5
6#[derive(Debug)]
7pub struct VectorStarted;
8
9impl InternalEvent for VectorStarted {
10 fn emit(self) {
11 info!(
12 target: "vector",
13 message = "Vector has started.",
14 debug = built_info::DEBUG,
15 version = built_info::PKG_VERSION,
16 arch = built_info::TARGET_ARCH,
17 revision = built_info::VECTOR_BUILD_DESC.unwrap_or(""),
18 );
19 counter!("started_total").increment(1);
20 }
21}
22
23#[derive(Debug)]
24pub struct VectorReloaded<'a> {
25 pub config_paths: &'a [config::ConfigPath],
26}
27
28impl InternalEvent for VectorReloaded<'_> {
29 fn emit(self) {
30 info!(
31 target: "vector",
32 message = "Vector has reloaded.",
33 path = ?self.config_paths
34 );
35 counter!("reloaded_total").increment(1);
36 }
37}
38
39#[derive(Debug)]
40pub struct VectorStopped;
41
42impl InternalEvent for VectorStopped {
43 fn emit(self) {
44 info!(
45 target: "vector",
46 message = "Vector has stopped."
47 );
48 counter!("stopped_total").increment(1);
49 }
50}
51
52#[derive(Debug)]
53pub struct VectorQuit;
54
55impl InternalEvent for VectorQuit {
56 fn emit(self) {
57 info!(
58 target: "vector",
59 message = "Vector has quit."
60 );
61 counter!("quit_total").increment(1);
62 }
63}
64
65#[derive(Debug)]
66pub struct VectorReloadError;
67
68impl InternalEvent for VectorReloadError {
69 fn emit(self) {
70 error!(
71 message = "Reload was not successful.",
72 error_code = "reload",
73 error_type = error_type::CONFIGURATION_FAILED,
74 stage = error_stage::PROCESSING,
75 internal_log_rate_limit = true,
76 );
77 counter!(
78 "component_errors_total",
79 "error_code" => "reload",
80 "error_type" => error_type::CONFIGURATION_FAILED,
81 "stage" => error_stage::PROCESSING,
82 )
83 .increment(1);
84 }
85}
86
87#[derive(Debug)]
88pub struct VectorConfigLoadError;
89
90impl InternalEvent for VectorConfigLoadError {
91 fn emit(self) {
92 error!(
93 message = "Failed to load config files, reload aborted.",
94 error_code = "config_load",
95 error_type = error_type::CONFIGURATION_FAILED,
96 stage = error_stage::PROCESSING,
97 internal_log_rate_limit = true,
98 );
99 counter!(
100 "component_errors_total",
101 "error_code" => "config_load",
102 "error_type" => error_type::CONFIGURATION_FAILED,
103 "stage" => error_stage::PROCESSING,
104 )
105 .increment(1);
106 }
107}
108
109#[derive(Debug)]
110pub struct VectorRecoveryError;
111
112impl InternalEvent for VectorRecoveryError {
113 fn emit(self) {
114 error!(
115 message = "Vector has failed to recover from a failed reload.",
116 error_code = "recovery",
117 error_type = error_type::CONFIGURATION_FAILED,
118 stage = error_stage::PROCESSING,
119 internal_log_rate_limit = true,
120 );
121 counter!(
122 "component_errors_total",
123 "error_code" => "recovery",
124 "error_type" => error_type::CONFIGURATION_FAILED,
125 "stage" => error_stage::PROCESSING,
126 )
127 .increment(1);
128 }
129}