MetricsProvider

Trait MetricsProvider 

Source
pub trait MetricsProvider: Send + Sync {
    // Required methods
    fn get_system_metrics(&self) -> impl Future<Output = SystemMetrics> + Send;
    fn get_blueprint_metrics(
        &self,
    ) -> impl Future<Output = BlueprintMetrics> + Send;
    fn get_blueprint_status(
        &self,
    ) -> impl Future<Output = BlueprintStatus> + Send;
    fn get_system_metrics_history(
        &self,
    ) -> impl Future<Output = Vec<SystemMetrics>> + Send;
    fn get_blueprint_metrics_history(
        &self,
    ) -> impl Future<Output = Vec<BlueprintMetrics>> + Send;
    fn add_custom_metric(
        &self,
        key: String,
        value: String,
    ) -> impl Future<Output = ()> + Send;
    fn set_blueprint_status(
        &self,
        status_code: u32,
        status_message: Option<String>,
    ) -> impl Future<Output = ()> + Send;
    fn update_last_heartbeat(
        &self,
        timestamp: u64,
    ) -> impl Future<Output = ()> + Send;
    fn start_collection(&self) -> impl Future<Output = Result<(), Error>> + Send;
}
Expand description

Trait for providing access to system and application metrics.

This trait defines the core interface for metric collection and retrieval in the QoS system. Implementers of this trait are responsible for collecting, storing, and exposing metrics about both the system (CPU, memory, etc.) and the application (blueprint-specific metrics). It supports both current and historical metric access as well as status updates.

Required Methods§

Source

fn get_system_metrics(&self) -> impl Future<Output = SystemMetrics> + Send

Get the latest system metrics

Source

fn get_blueprint_metrics(&self) -> impl Future<Output = BlueprintMetrics> + Send

Get the latest blueprint metrics

Source

fn get_blueprint_status(&self) -> impl Future<Output = BlueprintStatus> + Send

Get the current blueprint status

Source

fn get_system_metrics_history( &self, ) -> impl Future<Output = Vec<SystemMetrics>> + Send

Get the historical system metrics

Source

fn get_blueprint_metrics_history( &self, ) -> impl Future<Output = Vec<BlueprintMetrics>> + Send

Get the historical blueprint metrics

Source

fn add_custom_metric( &self, key: String, value: String, ) -> impl Future<Output = ()> + Send

Add a custom metric

Source

fn set_blueprint_status( &self, status_code: u32, status_message: Option<String>, ) -> impl Future<Output = ()> + Send

Set the blueprint status

Source

fn update_last_heartbeat( &self, timestamp: u64, ) -> impl Future<Output = ()> + Send

Update the last heartbeat timestamp

Source

fn start_collection(&self) -> impl Future<Output = Result<(), Error>> + Send

Start the metrics collection background task.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§