pub struct DatabaseMetrics { /* private fields */ }Expand description
Database metrics collector using OpenTelemetry.
Implementations§
Source§impl DatabaseMetrics
impl DatabaseMetrics
Sourcepub fn new(
pool_name: Option<&str>,
server_address: &str,
server_port: u16,
) -> Self
pub fn new( pool_name: Option<&str>, server_address: &str, server_port: u16, ) -> Self
Create a new metrics collector.
§Arguments
pool_name- Optional name to identify this pool in metricsserver_address- Server hostnameserver_port- Server port
Sourcepub fn record_pool_status(&self, in_use: u64, idle: u64, max: u64)
pub fn record_pool_status(&self, in_use: u64, idle: u64, max: u64)
Record pool connection status.
Sourcepub fn record_connection_created(&self)
pub fn record_connection_created(&self)
Record a connection being created.
Sourcepub fn record_connection_closed(&self)
pub fn record_connection_closed(&self)
Record a connection being closed.
Sourcepub fn record_operation(
&self,
operation: &str,
duration_seconds: f64,
success: bool,
)
pub fn record_operation( &self, operation: &str, duration_seconds: f64, success: bool, )
Record an operation duration.
Sourcepub fn record_connection_wait(&self, duration_seconds: f64)
pub fn record_connection_wait(&self, duration_seconds: f64)
Record time spent waiting for a connection from the pool.
Auto Trait Implementations§
impl !RefUnwindSafe for DatabaseMetrics
impl !UnwindSafe for DatabaseMetrics
impl Freeze for DatabaseMetrics
impl Send for DatabaseMetrics
impl Sync for DatabaseMetrics
impl Unpin for DatabaseMetrics
impl UnsafeUnpin for DatabaseMetrics
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