vector/internal_events/
gcp_pubsub.rs1use vector_lib::{
2 NamedInternalEvent, counter,
3 internal_event::{CounterName, InternalEvent, error_stage, error_type},
4};
5
6#[derive(NamedInternalEvent)]
7pub struct GcpPubsubConnectError {
8 pub error: tonic::transport::Error,
9}
10
11impl InternalEvent for GcpPubsubConnectError {
12 fn emit(self) {
13 error!(
14 message = "Failed to connect to the server.",
15 error = %self.error,
16 error_code = "failed_connecting",
17 error_type = error_type::CONNECTION_FAILED,
18 stage = error_stage::RECEIVING,
19 );
20
21 counter!(
22 CounterName::ComponentErrorsTotal,
23 "error_code" => "failed_connecting",
24 "error_type" => error_type::CONNECTION_FAILED,
25 "stage" => error_stage::RECEIVING,
26 )
27 .increment(1);
28 }
29}
30
31#[derive(NamedInternalEvent)]
32pub struct GcpPubsubStreamingPullError {
33 pub error: tonic::Status,
34}
35
36impl InternalEvent for GcpPubsubStreamingPullError {
37 fn emit(self) {
38 error!(
39 message = "Failed to set up streaming pull.",
40 error = %self.error,
41 error_code = "failed_streaming_pull",
42 error_type = error_type::REQUEST_FAILED,
43 stage = error_stage::RECEIVING,
44 );
45
46 counter!(
47 CounterName::ComponentErrorsTotal,
48 "error_code" => "failed_streaming_pull",
49 "error_type" => error_type::REQUEST_FAILED,
50 "stage" => error_stage::RECEIVING,
51 )
52 .increment(1);
53 }
54}
55
56#[derive(NamedInternalEvent)]
57pub struct GcpPubsubReceiveError {
58 pub error: tonic::Status,
59}
60
61impl InternalEvent for GcpPubsubReceiveError {
62 fn emit(self) {
63 error!(
64 message = "Failed to fetch events.",
65 error = %self.error,
66 error_code = "failed_fetching_events",
67 error_type = error_type::REQUEST_FAILED,
68 stage = error_stage::RECEIVING,
69 );
70
71 counter!(
72 CounterName::ComponentErrorsTotal,
73 "error_code" => "failed_fetching_events",
74 "error_type" => error_type::REQUEST_FAILED,
75 "stage" => error_stage::RECEIVING,
76 )
77 .increment(1);
78 }
79}