GatewayMetrics

Struct GatewayMetrics 

Source
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: AtomicU64

KeepAlive 超时断开数

Implementations§

Source§

impl GatewayMetrics

Source

pub fn new() -> Self

Source

pub fn record_latency_ns(&self, ns: u64)

记录一次请求延迟 (纳秒)

Source

pub fn latency_stats(&self) -> LatencyStats

获取延迟统计

Source

pub fn uptime_str(&self) -> String

格式化运行时间

Source

pub fn report(&self) -> String

生成 telnet 可展示的指标报告

Trait Implementations§

Source§

impl Default for GatewayMetrics

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more