1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Query monitoring and hooks for SQL execution.
//!
//! This module provides traits and utilities for:
//! - Monitoring SQL execution time
//! - Hooking into SQL execution lifecycle (before/after execution)
//! - Logging and metrics collection
//! - Query timeout with best-effort cancellation
//!
//! # Example
//!
//! ```rust,ignore
//! use pgorm::monitor::{InstrumentedClient, MonitorConfig, QueryContext, QueryMonitor, QueryResult};
//! use std::time::Duration;
//!
//! // Simple logging monitor
//! struct LoggingMonitor;
//!
//! impl QueryMonitor for LoggingMonitor {
//! fn on_query_complete(&self, ctx: &QueryContext, duration: Duration, result: &QueryResult) {
//! println!("[{:?}] {} - {:?}", duration, ctx.canonical_sql, result);
//! }
//! }
//!
//! // Use with instrumented client
//! let config = MonitorConfig::new()
//! .with_query_timeout(Duration::from_secs(30))
//! .with_slow_query_threshold(Duration::from_secs(5))
//! .enable_monitoring();
//!
//! let client = InstrumentedClient::new(db_client)
//! .with_config(config)
//! .with_monitor(LoggingMonitor);
//! ```
pub use MonitorConfig;
pub use InstrumentedClient;
pub use ;
pub use ;
pub use TracingSqlHook;
pub