pub struct PrometheusClient { /* private fields */ }Expand description
Prometheus API client
Implementations§
Source§impl PrometheusClient
impl PrometheusClient
Sourcepub fn new(config: PrometheusConfig) -> Result<Self, PrometheusError>
pub fn new(config: PrometheusConfig) -> Result<Self, PrometheusError>
Create a new PrometheusClient with the given configuration
Sourcepub async fn query(
&self,
query: &str,
time: Option<&str>,
) -> Result<PrometheusQueryResult, PrometheusError>
pub async fn query( &self, query: &str, time: Option<&str>, ) -> Result<PrometheusQueryResult, PrometheusError>
Execute an instant query
Sourcepub async fn query_range(
&self,
query: &str,
start: &str,
end: &str,
step: &str,
) -> Result<PrometheusQueryResult, PrometheusError>
pub async fn query_range( &self, query: &str, start: &str, end: &str, step: &str, ) -> Result<PrometheusQueryResult, PrometheusError>
Execute a range query
Sourcepub fn timestamp_to_prometheus_time(timestamp: SystemTime) -> String
pub fn timestamp_to_prometheus_time(timestamp: SystemTime) -> String
Convert a timestamp to a Prometheus-compatible time string
Sourcepub fn current_time() -> String
pub fn current_time() -> String
Get the current time as a Prometheus-compatible time string
Sourcepub async fn list_metrics(&self) -> Result<Vec<String>, PrometheusError>
pub async fn list_metrics(&self) -> Result<Vec<String>, PrometheusError>
List all metric names that can be queried from Prometheus
Sourcepub async fn get_metadata(
&self,
metric: &str,
) -> Result<Vec<MetricMetadata>, PrometheusError>
pub async fn get_metadata( &self, metric: &str, ) -> Result<Vec<MetricMetadata>, PrometheusError>
Get metadata about a specific metric
Sourcepub async fn get_series(
&self,
match_strings: Vec<&str>,
) -> Result<Vec<HashMap<String, String>>, PrometheusError>
pub async fn get_series( &self, match_strings: Vec<&str>, ) -> Result<Vec<HashMap<String, String>>, PrometheusError>
Get time series data for a specific metric with optional label matchers
Sourcepub async fn get_label_values(
&self,
label_name: &str,
) -> Result<Vec<String>, PrometheusError>
pub async fn get_label_values( &self, label_name: &str, ) -> Result<Vec<String>, PrometheusError>
Get all label values for a specific label name
Auto Trait Implementations§
impl Freeze for PrometheusClient
impl !RefUnwindSafe for PrometheusClient
impl Send for PrometheusClient
impl Sync for PrometheusClient
impl Unpin 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