pub struct QueryPerformanceTracker { /* private fields */ }
Expand description
Query performance tracker
Implementations§
Source§impl QueryPerformanceTracker
impl QueryPerformanceTracker
Sourcepub fn new(
max_metrics: usize,
slow_query_threshold_ms: u64,
fast_query_threshold_ms: u64,
) -> Self
pub fn new( max_metrics: usize, slow_query_threshold_ms: u64, fast_query_threshold_ms: u64, ) -> Self
Create a new query performance tracker
Sourcepub fn new_default() -> Self
pub fn new_default() -> Self
Create a new tracker with default settings
Sourcepub fn start_query(
&self,
query_type: &str,
query_text: &str,
parameters: Vec<String>,
) -> QueryContext
pub fn start_query( &self, query_type: &str, query_text: &str, parameters: Vec<String>, ) -> QueryContext
Start tracking a query execution
Sourcepub fn complete_query(
&self,
context: QueryContext,
cache_hit: bool,
result_size: Option<usize>,
memory_usage_bytes: Option<u64>,
cpu_usage_percent: Option<f64>,
optimization_applied: Vec<String>,
)
pub fn complete_query( &self, context: QueryContext, cache_hit: bool, result_size: Option<usize>, memory_usage_bytes: Option<u64>, cpu_usage_percent: Option<f64>, optimization_applied: Vec<String>, )
Complete query tracking with results
Sourcepub fn get_stats(&self, query_type: &str) -> Option<QueryPerformanceStats>
pub fn get_stats(&self, query_type: &str) -> Option<QueryPerformanceStats>
Get performance statistics for a specific query type
Sourcepub fn get_all_stats(&self) -> HashMap<String, QueryPerformanceStats>
pub fn get_all_stats(&self) -> HashMap<String, QueryPerformanceStats>
Get all performance statistics
Sourcepub fn get_optimization_suggestions(&self) -> Vec<QueryOptimizationSuggestion>
pub fn get_optimization_suggestions(&self) -> Vec<QueryOptimizationSuggestion>
Get optimization suggestions
Sourcepub fn get_slow_queries(&self) -> Vec<QueryPerformanceMetrics>
pub fn get_slow_queries(&self) -> Vec<QueryPerformanceMetrics>
Get slow queries (above threshold)
Sourcepub fn get_fast_queries(&self) -> Vec<QueryPerformanceMetrics>
pub fn get_fast_queries(&self) -> Vec<QueryPerformanceMetrics>
Get fast queries (below threshold)
Sourcepub fn get_performance_summary(&self) -> QueryPerformanceSummary
pub fn get_performance_summary(&self) -> QueryPerformanceSummary
Get query performance summary
Auto Trait Implementations§
impl Freeze for QueryPerformanceTracker
impl !RefUnwindSafe for QueryPerformanceTracker
impl Send for QueryPerformanceTracker
impl Sync for QueryPerformanceTracker
impl Unpin for QueryPerformanceTracker
impl !UnwindSafe for QueryPerformanceTracker
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> 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