vector_common/internal_event/
service.rs1use metrics::counter;
2
3use super::{ComponentEventsDropped, InternalEvent, UNINTENTIONAL, emit, error_stage, error_type};
4
5#[derive(Debug)]
6pub struct PollReadyError<E> {
7 pub error: E,
8}
9
10impl<E: std::fmt::Debug> InternalEvent for PollReadyError<E> {
11 fn emit(self) {
12 error!(
13 message = "Service poll ready failed.",
14 error = ?self.error,
15 error_type = error_type::REQUEST_FAILED,
16 stage = error_stage::SENDING,
17 );
18 counter!(
19 "component_errors_total",
20 "error_type" => error_type::REQUEST_FAILED,
21 "stage" => error_stage::SENDING,
22 )
23 .increment(1);
24 }
25
26 fn name(&self) -> Option<&'static str> {
27 Some("ServicePollReadyError")
28 }
29}
30
31#[derive(Debug)]
32pub struct CallError<E> {
33 pub error: E,
34 pub request_id: usize,
35 pub count: usize,
36}
37
38impl<E: std::fmt::Debug> InternalEvent for CallError<E> {
39 fn emit(self) {
40 let reason = "Service call failed. No retries or retries exhausted.";
41 error!(
42 message = reason,
43 error = ?self.error,
44 request_id = self.request_id,
45 error_type = error_type::REQUEST_FAILED,
46 stage = error_stage::SENDING,
47 );
48 counter!(
49 "component_errors_total",
50 "error_type" => error_type::REQUEST_FAILED,
51 "stage" => error_stage::SENDING,
52 )
53 .increment(1);
54
55 emit(ComponentEventsDropped::<UNINTENTIONAL> {
56 reason,
57 count: self.count,
58 });
59 }
60
61 fn name(&self) -> Option<&'static str> {
62 Some("ServiceCallError")
63 }
64}