vector/internal_events/
eventstoredb_metrics.rs

1use metrics::counter;
2use vector_lib::internal_event::{InternalEvent, error_stage, error_type};
3
4#[derive(Debug)]
5pub struct EventStoreDbMetricsHttpError {
6    pub error: crate::Error,
7}
8
9impl InternalEvent for EventStoreDbMetricsHttpError {
10    fn emit(self) {
11        error!(
12            message = "HTTP request processing error.",
13            error = ?self.error,
14            stage = error_stage::RECEIVING,
15            error_type = error_type::REQUEST_FAILED,
16        );
17        counter!(
18            "component_errors_total",
19            "stage" => error_stage::RECEIVING,
20            "error_type" => error_type::REQUEST_FAILED,
21        )
22        .increment(1);
23    }
24}
25
26#[derive(Debug)]
27pub struct EventStoreDbStatsParsingError {
28    pub error: serde_json::Error,
29}
30
31impl InternalEvent for EventStoreDbStatsParsingError {
32    fn emit(self) {
33        error!(
34            message = "JSON parsing error.",
35            error = ?self.error,
36            stage = error_stage::PROCESSING,
37            error_type = error_type::PARSER_FAILED,
38        );
39        counter!(
40            "component_errors_total",
41            "stage" => error_stage::PROCESSING,
42            "error_type" => error_type::PARSER_FAILED,
43        )
44        .increment(1);
45    }
46}