Skip to main content

MetricsClient

Trait MetricsClient 

Source
pub trait MetricsClient {
    // Required methods
    fn query(
        &self,
        request: QueryRequest,
        ctx: &Context,
    ) -> Promise<QueryResult>;
    fn fetch_label_names(&self, ctx: &Context) -> Promise<LabelsResult>;
    fn fetch_label_values(
        &self,
        label: &str,
        ctx: &Context,
    ) -> Promise<LabelsResult>;
    fn fetch_metric_names(&self, ctx: &Context) -> Promise<LabelsResult>;
    fn fetch_metric_labels(
        &self,
        metric: &str,
        ctx: &Context,
    ) -> Promise<MetricLabelsResult>;
    fn backend_type(&self) -> &'static str;
    fn health_check(&self, ctx: &Context) -> Promise<HealthCheckResult>;
}
Expand description

Metrics client trait - promise-based async interface.

Implementations handle the HTTP communication with the backend. All async methods return Promise objects that can be polled each frame.

Required Methods§

Source

fn query(&self, request: QueryRequest, ctx: &Context) -> Promise<QueryResult>

Execute a query request (non-blocking).

Returns a promise that resolves to the query result. The egui::Context is used to request a repaint when the response is ready.

Source

fn fetch_label_names(&self, ctx: &Context) -> Promise<LabelsResult>

Fetch all available label names (tag keys) from the backend.

For Prometheus, this calls /api/v1/labels.

Source

fn fetch_label_values( &self, label: &str, ctx: &Context, ) -> Promise<LabelsResult>

Fetch all values for a specific label (tag key) from the backend.

For Prometheus, this calls /api/v1/label/{label}/values.

Source

fn fetch_metric_names(&self, ctx: &Context) -> Promise<LabelsResult>

Fetch all metric names from the backend.

For Prometheus, this calls /api/v1/label/__name__/values.

Source

fn fetch_metric_labels( &self, metric: &str, ctx: &Context, ) -> Promise<MetricLabelsResult>

Fetch labels for a specific metric.

Returns all label names and their possible values for the given metric. For Prometheus, this calls /api/v1/series?match[]={__name__="metric"}.

Source

fn backend_type(&self) -> &'static str

Get the backend type identifier (e.g., “prometheus”, “enya”).

Source

fn health_check(&self, ctx: &Context) -> Promise<HealthCheckResult>

Check backend health and connectivity.

For Prometheus, this calls /api/v1/status/buildinfo. Returns backend version information on success.

Implementors§