pub struct PoolMetrics {
pub acquire_count: u64,
pub acquire_failed_count: u64,
pub acquire_wait_time: Duration,
pub release_count: u64,
pub connection_created_count: u64,
pub connection_closed_count: u64,
}Expand description
连接池累计统计指标(Prometheus 风格)
所有字段均为池生命周期内的累计值(不会随获取/归还重置),
由 Pool::pool_metrics() 返回。基于无锁 AtomicU64 计数,
对 acquire/release 热路径的影响可忽略(单条原子指令)。
Fields§
§acquire_count: u64累计成功获取连接次数
acquire_failed_count: u64累计获取连接失败次数(超时 / 连接创建失败 / 池已关闭 / 断路器或限流拒绝)
acquire_wait_time: Duration累计等待获取连接的时长(池满时阻塞等待的累计时间)
release_count: u64累计归还连接次数
connection_created_count: u64累计创建连接数(含 prewarm / warmup / acquire 新建)
connection_closed_count: u64累计关闭连接数(含过期回收 / 失效 / 池关闭)
Implementations§
Source§impl PoolMetrics
impl PoolMetrics
Sourcepub fn average_acquire_wait_time(&self) -> Duration
pub fn average_acquire_wait_time(&self) -> Duration
平均获取等待时长(无成功获取时为 0)
Trait Implementations§
Source§impl Clone for PoolMetrics
impl Clone for PoolMetrics
Source§fn clone(&self) -> PoolMetrics
fn clone(&self) -> PoolMetrics
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PoolMetrics
Source§impl Debug for PoolMetrics
impl Debug for PoolMetrics
Source§impl Default for PoolMetrics
impl Default for PoolMetrics
Source§fn default() -> PoolMetrics
fn default() -> PoolMetrics
Returns the “default value” for a type. Read more
impl Eq for PoolMetrics
Source§impl PartialEq for PoolMetrics
impl PartialEq for PoolMetrics
impl StructuralPartialEq for PoolMetrics
Auto Trait Implementations§
impl Freeze for PoolMetrics
impl RefUnwindSafe for PoolMetrics
impl Send for PoolMetrics
impl Sync for PoolMetrics
impl Unpin for PoolMetrics
impl UnsafeUnpin for PoolMetrics
impl UnwindSafe for PoolMetrics
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more