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