feldera_types/
adapter_stats.rs

1use serde::{Deserialize, Serialize};
2
3// Metrics for an input endpoint.
4///
5/// Serializes to match the subset of fields needed for error tracking.
6#[derive(Default, Serialize, Deserialize, Debug, Clone)]
7pub struct InputEndpointErrorMetrics {
8    pub endpoint_name: String,
9    #[serde(default)]
10    pub num_transport_errors: u64,
11    #[serde(default)]
12    pub num_parse_errors: u64,
13}
14
15/// Metrics for an output endpoint.
16///
17/// Serializes to match the subset of fields needed for error tracking.
18#[derive(Default, Serialize, Deserialize, Debug, Clone)]
19pub struct OutputEndpointErrorMetrics {
20    pub endpoint_name: String,
21    #[serde(default)]
22    pub num_encode_errors: u64,
23    #[serde(default)]
24    pub num_transport_errors: u64,
25}
26
27/// Endpoint statistics containing metrics.
28///
29/// Wraps metrics in a structure that matches the full stats API shape.
30#[derive(Serialize, Deserialize, Debug, Clone)]
31pub struct EndpointErrorStats<T> {
32    #[serde(default)]
33    pub metrics: T,
34}
35
36/// Pipeline error statistics response from the runtime.
37///
38/// Lightweight response containing only error counts from all endpoints.
39#[derive(Serialize, Deserialize, Debug, Clone)]
40pub struct PipelineStatsErrorsResponse {
41    #[serde(default)]
42    pub inputs: Vec<EndpointErrorStats<InputEndpointErrorMetrics>>,
43    #[serde(default)]
44    pub outputs: Vec<EndpointErrorStats<OutputEndpointErrorMetrics>>,
45}