vector/internal_events/
influxdb.rs1use metrics::counter;
2use vector_lib::internal_event::InternalEvent;
3use vector_lib::internal_event::{error_stage, error_type, ComponentEventsDropped, UNINTENTIONAL};
4
5#[derive(Debug)]
6pub struct InfluxdbEncodingError {
7 pub error_message: &'static str,
8 pub count: usize,
9}
10
11impl InternalEvent for InfluxdbEncodingError {
12 fn emit(self) {
13 let reason = "Failed to encode event.";
14 error!(
15 message = reason,
16 error = %self.error_message,
17 error_type = error_type::ENCODER_FAILED,
18 stage = error_stage::PROCESSING,
19 internal_log_rate_limit = true,
20 );
21 counter!(
22 "component_errors_total",
23 "error_type" => error_type::ENCODER_FAILED,
24 "stage" => error_stage::PROCESSING,
25 )
26 .increment(1);
27
28 emit!(ComponentEventsDropped::<UNINTENTIONAL> {
29 count: self.count,
30 reason
31 });
32 }
33}