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 method
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.