Public declaration syntax from forge-rs/crates/forge-health/src/profile.rs Original source SHA-256: 449021c7907ed853d737e559b89ba9f95472b87c156b6864ad484d07fed3fd03 Function bodies and constant values are omitted. This is not the complete implementation. Source line 64 #[derive(Debug, Clone, Serialize, Deserialize)] pub struct HealthProfile { /// Total uptime of the agent in seconds. /// /// This is updated externally by the monitoring system based on the /// elapsed time since the agent entered the Active state. pub uptime_seconds: u64, /// Total number of errors recorded during the agent's lifetime. /// /// This counter is monotonically increasing. pub error_count: u64, /// Total number of tool invocations executed by the agent. /// /// Includes both successful and failed invocations. pub tool_invocations: u64, /// Total number of inference calls (LLM generation requests) made. pub inference_calls: u64, /// Total number of tokens consumed across all inference calls. pub inference_tokens: u64, /// Current CPU usage as a percentage (0.0 to 100.0). /// /// This is a point-in-time measurement updated by `update_resources`. pub cpu_usage_percent: f64, /// Current memory usage in bytes. /// /// This is a point-in-time measurement updated by `update_resources`. pub memory_usage_bytes: u64, /// Number of currently active (in-flight) tasks. /// /// Incremented by `record_task_started`, decremented by `record_task_completed`. /// This gauge can reach zero and will not go below zero (saturating subtraction). pub active_tasks: u32, /// Total number of tasks completed during the agent's lifetime. /// /// This counter is monotonically increasing. pub completed_tasks: u64, /// Current error rate as a fraction (0.0 to 1.0). /// /// Computed as `errors / (errors + successes)` across all generation calls. /// Updated by `record_generation_success` and `record_generation_failure`. pub error_rate: f64, /// Average latency of completed operations in milliseconds. /// /// Updated externally by the monitoring system. pub avg_latency_ms: f64, /// Tool invocation success rate as a fraction (0.0 to 1.0). /// /// Computed as `successes / total` across all tool invocations. pub tool_success_rate: f64, /// Generation success rate as a fraction (0.0 to 1.0). /// /// Computed as `successes / total` across all generation calls. /// Updated by `record_generation_success` and `record_generation_failure`. pub generation_success_rate: f64, /// Timestamp of the last profile update. pub last_updated: Timestamp } Source line 164 pub fn new() -> Self; Source line 200 pub fn record_tool_invocation(&mut self); Source line 225 pub fn record_inference(&mut self, tokens: u64); Source line 245 pub fn record_error(&mut self); Source line 270 pub fn update_resources(&mut self, cpu: f64, memory: u64); Source line 291 pub fn update_uptime(&mut self, seconds: u64); Source line 312 pub fn record_task_started(&mut self); Source line 335 pub fn record_task_completed(&mut self); Source line 357 pub fn record_generation_success(&mut self); Source line 379 pub fn record_generation_failure(&mut self);