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