pub trait ResourceMonitor:
Send
+ Sync
+ Debug
+ 'static {
// Required methods
fn monitor_id(&self) -> Cow<'static, str>;
fn resource_type(&self) -> MonitoredResourceType;
fn get_usage_report(&self) -> ResourceUsageReport;
fn as_any(&self) -> &dyn Any;
// Provided methods
fn get_gpu_report(&self) -> Option<GpuReport> { ... }
fn get_hardware_report(&self) -> Option<HardwareReport> { ... }
fn get_metrics(&self) -> Vec<(MetricId, MetricValue)> { ... }
fn update(&self) { ... }
}Expand description
The core trait for a resource monitor.
A ResourceMonitor is a stateful object, typically living in the khora-infra
crate, that knows how to query a specific system resource. The khora-telemetry
service will hold a collection of these monitors and periodically call update
and get_usage_report on them.
Required Methods§
Sourcefn monitor_id(&self) -> Cow<'static, str>
fn monitor_id(&self) -> Cow<'static, str>
Returns a unique, human-readable identifier for this monitor instance.
Sourcefn resource_type(&self) -> MonitoredResourceType
fn resource_type(&self) -> MonitoredResourceType
Returns the general type of resource being monitored.
Sourcefn get_usage_report(&self) -> ResourceUsageReport
fn get_usage_report(&self) -> ResourceUsageReport
Returns a snapshot of the current usage data for the monitored resource.
Provided Methods§
Sourcefn get_gpu_report(&self) -> Option<GpuReport>
fn get_gpu_report(&self) -> Option<GpuReport>
Returns a GPU performance report, if this monitor supports it.
Sourcefn get_hardware_report(&self) -> Option<HardwareReport>
fn get_hardware_report(&self) -> Option<HardwareReport>
Returns a hardware health report, if this monitor supports it.
Sourcefn get_metrics(&self) -> Vec<(MetricId, MetricValue)>
fn get_metrics(&self) -> Vec<(MetricId, MetricValue)>
Returns a list of discrete metrics collected by this monitor.