rust_ef/observability/mod.rs
1//! Tracing/observability instrumentation guards.
2//!
3//! When the `tracing` feature is disabled, all guards are zero-sized types
4//! with no-op constructors — eliminated entirely by the compiler.
5//!
6//! # Usage
7//!
8//! Providers and connections create guards at the start of instrumented
9//! operations. The guard emits a tracing event on `Drop`:
10//!
11//! - [`QueryGuard`] — wraps a single `query`/`execute` call; emits `DEBUG`
12//! on completion, `WARN` if the elapsed time exceeds the slow-query
13//! threshold.
14//! - [`PoolAcquireGuard`] — wraps a connection-pool acquisition; emits
15//! `INFO` with the acquire duration.
16//! - [`SaveChangesGuard`] — wraps a `save_changes` call; emits `INFO`
17//! with the total elapsed time.
18
19mod pool_guard;
20mod query_guard;
21mod save_changes_guard;
22
23pub use pool_guard::PoolAcquireGuard;
24pub use query_guard::QueryGuard;
25pub use save_changes_guard::SaveChangesGuard;