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            internal_log_rate_limit = true,
17        );
18        counter!(
19            "component_errors_total",
20            "stage" => error_stage::RECEIVING,
21            "error_type" => error_type::REQUEST_FAILED,
22        )
23        .increment(1);
24    }
25}
26
27#[derive(Debug)]
28pub struct EventStoreDbStatsParsingError {
29    pub error: serde_json::Error,
30}
31
32impl InternalEvent for EventStoreDbStatsParsingError {
33    fn emit(self) {
34        error!(
35            message = "JSON parsing error.",
36            error = ?self.error,
37            stage = error_stage::PROCESSING,
38            error_type = error_type::PARSER_FAILED,
39            internal_log_rate_limit = true,
40        );
41        counter!(
42            "component_errors_total",
43            "stage" => error_stage::PROCESSING,
44            "error_type" => error_type::PARSER_FAILED,
45        )
46        .increment(1);
47    }
48}