vector/internal_events/
datadog_traces.rs1use vector_lib::internal_event::{
2 ComponentEventsDropped, CounterName, InternalEvent, UNINTENTIONAL, error_stage, error_type,
3};
4use vector_lib::{NamedInternalEvent, counter};
5
6#[derive(Debug, NamedInternalEvent)]
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 );
23 counter!(
24 CounterName::ComponentErrorsTotal,
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, NamedInternalEvent)]
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 );
52 counter!(
53 CounterName::ComponentErrorsTotal,
54 "error_type" => error_type::WRITER_FAILED,
55 "stage" => error_stage::SENDING,
56 )
57 .increment(1);
58
59 }
61}