vector/internal_events/
datadog_traces.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 DatadogTracesEncodingError {
7 pub error_message: &'static str,
8 pub error_reason: String,
9 pub dropped_events: usize,
10}
11
12impl InternalEvent for DatadogTracesEncodingError {
13 fn emit(self) {
14 let reason = "Failed to encode Datadog traces.";
15 error!(
16 message = reason,
17 error = %self.error_message,
18 error_reason = %self.error_reason,
19 error_type = error_type::ENCODER_FAILED,
20 stage = error_stage::PROCESSING,
21 internal_log_rate_limit = true,
22 );
23 counter!(
24 "component_errors_total",
25 "error_type" => error_type::ENCODER_FAILED,
26 "stage" => error_stage::PROCESSING,
27 )
28 .increment(1);
29
30 if self.dropped_events > 0 {
31 emit!(ComponentEventsDropped::<UNINTENTIONAL> {
32 count: self.dropped_events,
33 reason,
34 });
35 }
36 }
37}
38
39#[derive(Debug)]
40pub struct DatadogTracesAPMStatsError<E> {
41 pub error: E,
42}
43
44impl<E: std::fmt::Display> InternalEvent for DatadogTracesAPMStatsError<E> {
45 fn emit(self) {
46 error!(
47 message = "Failed sending APM stats payload.",
48 error = %self.error,
49 error_type = error_type::WRITER_FAILED,
50 stage = error_stage::SENDING,
51 internal_log_rate_limit = true,
52 );
53 counter!(
54 "component_errors_total",
55 "error_type" => error_type::WRITER_FAILED,
56 "stage" => error_stage::SENDING,
57 )
58 .increment(1);
59
60 }
62}