pub struct PoolEvent {
pub event_id: Uuid,
pub event_type: PoolEventType,
pub timestamp: DateTime<Utc>,
pub pool_size: u32,
pub idle_connections: u32,
pub wait_time_ms: Option<u64>,
pub error: Option<String>,
pub metadata: HashMap<String, String>,
}Expand description
Pool event data
Fields§
§event_id: UuidUnique event ID
event_type: PoolEventTypeEvent type
timestamp: DateTime<Utc>Timestamp when event occurred
pool_size: u32Pool size at time of event
idle_connections: u32Number of idle connections
wait_time_ms: Option<u64>Wait time in milliseconds (for acquire events)
error: Option<String>Error message (if applicable)
metadata: HashMap<String, String>Additional metadata
Implementations§
Source§impl PoolEvent
impl PoolEvent
Sourcepub fn new(
event_type: PoolEventType,
pool_size: u32,
idle_connections: u32,
) -> Self
pub fn new( event_type: PoolEventType, pool_size: u32, idle_connections: u32, ) -> Self
Create a new pool event
Sourcepub fn with_wait_time(self, wait_time: Duration) -> Self
pub fn with_wait_time(self, wait_time: Duration) -> Self
Add wait time
Sourcepub fn with_error(self, error: String) -> Self
pub fn with_error(self, error: String) -> Self
Add error message
Sourcepub fn add_metadata(self, key: String, value: String) -> Self
pub fn add_metadata(self, key: String, value: String) -> Self
Add metadata
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PoolEvent
impl<'de> Deserialize<'de> for PoolEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PoolEvent
impl RefUnwindSafe for PoolEvent
impl Send for PoolEvent
impl Sync for PoolEvent
impl Unpin for PoolEvent
impl UnwindSafe for PoolEvent
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