pub struct PrometheusClient { /* private fields */ }Expand description
Client for querying Prometheus via its HTTP API.
Executes PromQL queries directly against the /api/v1/query_range endpoint.
Uses reqwest for HTTP requests on both native (with tokio) and WASM (with
wasm-bindgen-futures).
§Example
ⓘ
use enya_client::{QueryManager, QueryRequest};
use enya_client::prometheus::PrometheusClient;
let client = PrometheusClient::new("http://localhost:9090");
let mut manager = QueryManager::new();
let request = QueryRequest::new("cpu_usage", "sum(env:prod) by (host)");
manager.execute(&client, request, &ctx);Implementations§
Trait Implementations§
Source§impl MetricsClient for PrometheusClient
impl MetricsClient for PrometheusClient
Source§fn query(&self, request: QueryRequest, ctx: &Context) -> Promise<QueryResult>
fn query(&self, request: QueryRequest, ctx: &Context) -> Promise<QueryResult>
Execute a query request (non-blocking). Read more
Source§fn 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. Read more
Source§fn 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. Read more
Source§fn fetch_metric_names(&self, ctx: &Context) -> Promise<LabelsResult>
fn fetch_metric_names(&self, ctx: &Context) -> Promise<LabelsResult>
Fetch all metric names from the backend. Read more
Source§fn 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. Read more
Source§fn backend_type(&self) -> &'static str
fn backend_type(&self) -> &'static str
Get the backend type identifier (e.g., “prometheus”, “enya”).
Source§fn health_check(&self, ctx: &Context) -> Promise<HealthCheckResult>
fn health_check(&self, ctx: &Context) -> Promise<HealthCheckResult>
Check backend health and connectivity. Read more
Auto Trait Implementations§
impl Freeze for PrometheusClient
impl !RefUnwindSafe for PrometheusClient
impl Send for PrometheusClient
impl Sync for PrometheusClient
impl Unpin for PrometheusClient
impl UnsafeUnpin for PrometheusClient
impl !UnwindSafe for PrometheusClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more