@@ -210,42 +210,63 @@ impl MetricsCollector {
210210/// Snapshot of metrics at a point in time
211211#[ derive( Debug , Clone , serde:: Serialize ) ]
212212pub struct MetricsSnapshot {
213+ /// System uptime in seconds
213214 pub uptime_seconds : u64 ,
215+ /// Error counts by error type
214216 pub error_counts : HashMap < String , u64 > ,
217+ /// Distribution of errors by severity level
215218 pub error_severity_distribution : HashMap < String , u64 > ,
219+ /// Metrics for each tracked operation
216220 pub operation_metrics : HashMap < String , OperationMetrics > ,
221+ /// Resource usage statistics
217222 pub resource_usage : HashMap < String , u64 > ,
218223}
219224
225+ /// Metrics for a specific operation
220226#[ derive( Debug , Clone , serde:: Serialize ) ]
221227pub struct OperationMetrics {
228+ /// Number of successful executions
222229 pub success_count : u64 ,
230+ /// Total number of executions
223231 pub total_count : u64 ,
232+ /// Error rate as a decimal (0.0 to 1.0)
224233 pub error_rate : f64 ,
234+ /// Average latency in milliseconds
225235 pub average_latency_ms : Option < u64 > ,
226236}
227237
228238/// Health check status
229239#[ derive( Debug , Clone , PartialEq , serde:: Serialize ) ]
230240pub enum HealthStatus {
241+ /// All systems functioning normally
231242 Healthy ,
243+ /// Some issues detected but system is still operational
232244 Degraded ,
245+ /// Critical issues preventing normal operation
233246 Unhealthy ,
234247}
235248
236249/// Health check result
237250#[ derive( Debug , Clone , serde:: Serialize ) ]
238251pub struct HealthCheckResult {
252+ /// Overall system health status
239253 pub status : HealthStatus ,
254+ /// Individual component health checks
240255 pub checks : HashMap < String , ComponentHealth > ,
256+ /// Human-readable status message
241257 pub overall_message : String ,
258+ /// When this health check was performed
242259 pub timestamp : chrono:: DateTime < chrono:: Utc > ,
243260}
244261
262+ /// Health status of a specific system component
245263#[ derive( Debug , Clone , serde:: Serialize ) ]
246264pub struct ComponentHealth {
265+ /// Health status of this component
247266 pub status : HealthStatus ,
267+ /// Descriptive message about the component's health
248268 pub message : String ,
269+ /// Additional metrics relevant to this component
249270 pub metrics : Option < HashMap < String , serde_json:: Value > > ,
250271}
251272
@@ -547,10 +568,14 @@ impl PerformanceMonitor {
547568 }
548569}
549570
571+ /// Performance metrics for a specific operation
550572#[ derive( Debug , Clone ) ]
551573pub struct OperationPerformance {
574+ /// Name of the operation
552575 pub operation : String ,
576+ /// Error rate as a decimal (0.0 to 1.0)
553577 pub error_rate : f64 ,
578+ /// Average execution time
554579 pub average_latency : Duration ,
555580}
556581
0 commit comments