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