Skip to main content

DbMetrics

Struct DbMetrics 

Source
pub struct DbMetrics {
Show 15 fields pub total_memory: usize, pub used_memory: AtomicUsize, pub read_ops: AtomicU32, pub write_ops: AtomicU32, pub delete_ops: AtomicU32, pub update_ops: AtomicU32, pub cache_hits: AtomicU32, pub cache_misses: AtomicU32, pub index_lookups: AtomicU32, pub index_inserts: AtomicU32, pub index_deletes: AtomicU32, pub transactions: AtomicU32, pub committed_transactions: AtomicU32, pub rolled_back_transactions: AtomicU32, pub gc_ops: AtomicU32,
}
Expand description

数据库监控指标

Fields§

§total_memory: usize

总内存(字节)

§used_memory: AtomicUsize

已使用内存(字节)

§read_ops: AtomicU32

读取操作计数

§write_ops: AtomicU32

写入操作计数

§delete_ops: AtomicU32

删除操作计数

§update_ops: AtomicU32

更新操作计数

§cache_hits: AtomicU32

缓存命中次数

§cache_misses: AtomicU32

缓存未命中次数

§index_lookups: AtomicU32

索引查找次数

§index_inserts: AtomicU32

索引插入次数

§index_deletes: AtomicU32

索引删除次数

§transactions: AtomicU32

事务总数

§committed_transactions: AtomicU32

已提交事务数

§rolled_back_transactions: AtomicU32

已回滚事务数

§gc_ops: AtomicU32

垃圾回收操作计数

Implementations§

Source§

impl DbMetrics

Source

pub fn new(total_memory: usize) -> Self

创建新的监控指标实例

Source

pub fn snapshot(&self) -> DbMetricsSnapshot

创建指标快照

Source

pub fn reset(&self)

重置所有指标

Source

pub fn inc_read_ops(&self)

增加读取操作计数

Source

pub fn inc_write_ops(&self)

增加写入操作计数

Source

pub fn inc_delete_ops(&self)

增加删除操作计数

Source

pub fn inc_update_ops(&self)

增加更新操作计数

Source

pub fn inc_cache_hits(&self)

增加缓存命中次数

Source

pub fn inc_cache_misses(&self)

增加缓存未命中次数

Source

pub fn inc_index_lookups(&self)

增加索引查找次数

Source

pub fn inc_index_inserts(&self)

增加索引插入次数

Source

pub fn inc_index_deletes(&self)

增加索引删除次数

Source

pub fn inc_transactions(&self)

增加事务计数

Source

pub fn inc_committed_transactions(&self)

增加已提交事务计数

Source

pub fn inc_rolled_back_transactions(&self)

增加已回滚事务计数

Source

pub fn inc_gc_ops(&self)

增加垃圾回收操作计数

Source

pub fn set_used_memory(&self, memory: usize)

更新已使用内存

Source

pub fn add_used_memory(&self, memory: usize)

增加已使用内存

Source

pub fn sub_used_memory(&self, memory: usize)

减少已使用内存

Trait Implementations§

Source§

impl Debug for DbMetrics

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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.

Source§

impl<T> Instrument for T

Source§

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

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

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, 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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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