modbus_relay/connection/stats/
client.rs1use std::time::SystemTime;
2
3use serde::Serialize;
4
5#[derive(Debug, Clone, Serialize)]
7pub struct Stats {
8 pub active_connections: usize,
10 pub total_requests: u64,
12 pub total_errors: u64,
14 pub last_active: SystemTime,
16 pub last_error: Option<SystemTime>,
18 pub avg_response_time_ms: u64,
20}
21
22impl Default for Stats {
23 fn default() -> Self {
24 Self {
25 active_connections: 0,
26 total_requests: 0,
27 total_errors: 0,
28 last_active: SystemTime::now(),
29 last_error: None,
30 avg_response_time_ms: 0,
31 }
32 }
33}