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
//! Monitoring and metrics infrastructure for hybrid search.
//!
//! This module provides comprehensive observability for the search system:
//! - Prometheus metrics for latency, throughput, and error tracking
//! - Structured logging with tracing
//! - Performance monitoring and alerting
//!
//! # Metrics Exposed
//!
//! - `maproom_search_query_latency_seconds` - End-to-end search latency histogram
//! - `maproom_search_fusion_time_seconds` - Score fusion computation time histogram
//! - `maproom_search_cache_hit_rate` - Cache effectiveness gauge (0.0-1.0)
//! - `maproom_search_result_count` - Number of results returned per query histogram
//! - `maproom_search_errors_total` - Counter for errors by type
//! - `maproom_search_queries_total` - Total number of search queries counter
//!
//! # Alert Thresholds
//!
//! - **p95 latency > 50ms**: Performance degradation warning
//! - **p95 latency > 100ms**: Critical performance issue
//! - **Error rate > 1%**: Reliability issue warning
//! - **Error rate > 5%**: Critical reliability issue
//! - **Cache hit rate < 50%**: Cache effectiveness warning
//!
//! # Usage
//!
//! ```no_run
//! use maproom::metrics::{SearchMetrics, get_metrics};
//! use std::time::Instant;
//!
//! #[tokio::main]
//! async fn main() {
//! let metrics = get_metrics();
//!
//! let start = Instant::now();
//! // ... perform search ...
//! let duration = start.elapsed();
//!
//! metrics.record_query_latency(duration.as_secs_f64(), "code", true);
//! metrics.record_result_count(10, "code");
//! metrics.increment_queries("code", true);
//! }
//! ```
pub use CacheMetrics;
pub use ;
pub use ;
pub use ;