pub struct GatewayMetrics {Show 17 fields
pub start_time: Instant,
pub total_connections: AtomicU64,
pub total_disconnections: AtomicU64,
pub rejected_connections: AtomicU64,
pub total_requests: AtomicU64,
pub total_request_errors: AtomicU64,
pub total_response_bytes: AtomicU64,
pub backend_reconnects: AtomicU64,
pub backend_reconnect_failures: AtomicU64,
pub last_reconnect_ms: AtomicU64,
pub backend_online: AtomicU64,
pub backend_pushes_received: AtomicU64,
pub client_pushes_sent: AtomicU64,
pub qot_subscribe_ops: AtomicU64,
pub qot_unsubscribe_ops: AtomicU64,
pub resubscribe_ops: AtomicU64,
pub keepalive_timeouts: AtomicU64,
/* private fields */
}Expand description
网关运行时监控指标
Fields§
§start_time: Instant网关启动时间
total_connections: AtomicU64累计接受的客户端连接数
total_disconnections: AtomicU64累计客户端断开数
rejected_connections: AtomicU64被拒绝的连接数(超过上限)
total_requests: AtomicU64累计处理的请求数
total_request_errors: AtomicU64累计请求错误数(handler 返回 None 或解密失败)
total_response_bytes: AtomicU64累计响应字节数
backend_reconnects: AtomicU64后端重连次数
backend_reconnect_failures: AtomicU64后端重连失败次数
last_reconnect_ms: AtomicU64最近一次重连时间 (Unix 毫秒, 0=未重连过)
backend_online: AtomicU64后端是否在线 (1=online, 0=offline)
backend_pushes_received: AtomicU64后端收到的推送数 (CMD 6212 / 4716 / 5300 等)
client_pushes_sent: AtomicU64向客户端发送的推送数
qot_subscribe_ops: AtomicU64行情订阅操作次数
qot_unsubscribe_ops: AtomicU64行情退订操作次数
resubscribe_ops: AtomicU64重连后重新订阅次数
keepalive_timeouts: AtomicU64KeepAlive 超时断开数
Implementations§
Source§impl GatewayMetrics
impl GatewayMetrics
pub fn new() -> Self
Sourcepub fn record_latency_ns(&self, ns: u64)
pub fn record_latency_ns(&self, ns: u64)
记录一次请求延迟 (纳秒)
Sourcepub fn latency_stats(&self) -> LatencyStats
pub fn latency_stats(&self) -> LatencyStats
获取延迟统计
Sourcepub fn uptime_str(&self) -> String
pub fn uptime_str(&self) -> String
格式化运行时间
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for GatewayMetrics
impl !RefUnwindSafe for GatewayMetrics
impl Send for GatewayMetrics
impl Sync for GatewayMetrics
impl Unpin for GatewayMetrics
impl UnwindSafe for GatewayMetrics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more