Enum diesel::connection::InstrumentationEvent
source · #[non_exhaustive]pub enum InstrumentationEvent<'a> {
StartEstablishConnection {
url: &'a str,
},
FinishEstablishConnection {
url: &'a str,
error: Option<&'a ConnectionError>,
},
StartQuery {
query: &'a dyn DebugQuery,
},
CacheQuery {
sql: &'a str,
},
FinishQuery {
query: &'a dyn DebugQuery,
error: Option<&'a Error>,
},
BeginTransaction {
depth: NonZeroU32,
},
CommitTransaction {
depth: NonZeroU32,
},
RollbackTransaction {
depth: NonZeroU32,
},
}
Expand description
This enum describes possible connection events
that can be handled by an Instrumentation
implementation
Some fields might contain sensitive information, like login details for the database.
Diesel does not guarantee that future versions will
emit the same events in the same order or timing.
In addition the output of the Debug
and Display
implementation of the enum itself and any of its fields
is not guarantee to be stable.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
StartEstablishConnection
An event emitted by before starting establishing a new connection
Fields
This variant is marked as non-exhaustive
FinishEstablishConnection
An event emitted after establishing a new connection
Fields
This variant is marked as non-exhaustive
url: &'a str
The database url the connection tries is connected to
This might contain sensitive information like the database password
error: Option<&'a ConnectionError>
An optional error if the connection failed
StartQuery
An event that is emitted before executing a query
Fields
This variant is marked as non-exhaustive
CacheQuery
An event that is emitted when a query is cached in the connection internal prepared statement cache
Fields
This variant is marked as non-exhaustive
FinishQuery
An event that is emitted after executing a query
Fields
This variant is marked as non-exhaustive
query: &'a dyn DebugQuery
BeginTransaction
An event that is emitted while starting a new transaction
Fields
This variant is marked as non-exhaustive
depth: NonZeroU32
Transaction level of the newly started transaction
CommitTransaction
An event that is emitted while committing a transaction
Fields
This variant is marked as non-exhaustive
depth: NonZeroU32
Transaction level of the to be committed transaction
RollbackTransaction
An event that is emitted while rolling back a transaction
Fields
This variant is marked as non-exhaustive
depth: NonZeroU32
Transaction level of the to be rolled back transaction
Implementations§
source§impl<'a> InstrumentationEvent<'a>
impl<'a> InstrumentationEvent<'a>
sourcepub fn start_establish_connection(url: &'a str) -> Self
pub fn start_establish_connection(url: &'a str) -> Self
Create a new InstrumentationEvent::StartEstablishConnection
event
sourcepub fn finish_establish_connection(
url: &'a str,
error: Option<&'a ConnectionError>,
) -> Self
pub fn finish_establish_connection( url: &'a str, error: Option<&'a ConnectionError>, ) -> Self
Create a new InstrumentationEvent::FinishEstablishConnection
event
sourcepub fn start_query(query: &'a dyn DebugQuery) -> Self
pub fn start_query(query: &'a dyn DebugQuery) -> Self
Create a new InstrumentationEvent::StartQuery
event
sourcepub fn cache_query(sql: &'a str) -> Self
pub fn cache_query(sql: &'a str) -> Self
Create a new InstrumentationEvent::CacheQuery
event
sourcepub fn finish_query(query: &'a dyn DebugQuery, error: Option<&'a Error>) -> Self
pub fn finish_query(query: &'a dyn DebugQuery, error: Option<&'a Error>) -> Self
Create a new InstrumentationEvent::FinishQuery
event
sourcepub fn begin_transaction(depth: NonZeroU32) -> Self
pub fn begin_transaction(depth: NonZeroU32) -> Self
Create a new InstrumentationEvent::BeginTransaction
event
sourcepub fn rollback_transaction(depth: NonZeroU32) -> Self
pub fn rollback_transaction(depth: NonZeroU32) -> Self
Create a new InstrumentationEvent::RollbackTransaction
event
sourcepub fn commit_transaction(depth: NonZeroU32) -> Self
pub fn commit_transaction(depth: NonZeroU32) -> Self
Create a new InstrumentationEvent::CommitTransaction
event