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§
Sourcefn query(&self, request: QueryRequest, ctx: &Context) -> Promise<QueryResult>
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.
Sourcefn fetch_label_names(&self, ctx: &Context) -> Promise<LabelsResult>
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.
Sourcefn fetch_label_values(
&self,
label: &str,
ctx: &Context,
) -> Promise<LabelsResult>
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.
Sourcefn fetch_metric_names(&self, ctx: &Context) -> Promise<LabelsResult>
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.
Sourcefn fetch_metric_labels(
&self,
metric: &str,
ctx: &Context,
) -> Promise<MetricLabelsResult>
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"}.
Sourcefn backend_type(&self) -> &'static str
fn backend_type(&self) -> &'static str
Get the backend type identifier (e.g., “prometheus”, “enya”).
Sourcefn health_check(&self, ctx: &Context) -> Promise<HealthCheckResult>
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.