pub struct InstantQueryBuilder { /* private fields */ }
Expand description
Provides a builder to set some query parameters in the context of an instant query before sending it to Prometheus.
Implementations§
source§impl InstantQueryBuilder
impl InstantQueryBuilder
sourcepub fn at(self, time: i64) -> Self
pub fn at(self, time: i64) -> Self
Set the evaluation timestamp (Unix timestamp in seconds, e.g. 1659182624). If this is not set the evaluation timestamp will default to the current Prometheus server time. See also: Prometheus API documentation
sourcepub fn timeout(self, timeout: i64) -> Self
pub fn timeout(self, timeout: i64) -> Self
Set the evaluation timeout (milliseconds, e.g. 1000). If this is not set the timeout will default to the value of the “-query.timeout” flag of the Prometheus server. See also: Prometheus API documentation
sourcepub fn stats(self) -> Self
pub fn stats(self) -> Self
Instruct Prometheus to compile query statistics as part of the API response.
sourcepub fn header<K: IntoHeaderName, T: Into<HeaderValue>>(
self,
name: K,
value: T
) -> Self
pub fn header<K: IntoHeaderName, T: Into<HeaderValue>>( self, name: K, value: T ) -> Self
Include an additional header to the request.
sourcepub fn query(self, name: &'static str, value: impl ToString) -> Self
pub fn query(self, name: &'static str, value: impl ToString) -> Self
Include an additional parameter to the request.
sourcepub async fn get(self) -> Result<PromqlResult, Error>
pub async fn get(self) -> Result<PromqlResult, Error>
Execute the instant query (using HTTP GET) and return the parsed API response.
sourcepub async fn post(self) -> Result<PromqlResult, Error>
pub async fn post(self) -> Result<PromqlResult, Error>
Execute the instant query (using HTTP POST) and return the parsed API response. Using a POST request is useful in the context of larger PromQL queries when the size of the final URL may break Prometheus’ or an intermediate proxies’ URL character limits.
sourcepub async fn get_raw(self) -> Result<Response, Error>
pub async fn get_raw(self) -> Result<Response, Error>
Execute the instant query (using HTTP GET) and return the raw API response.
sourcepub async fn post_raw(self) -> Result<Response, Error>
pub async fn post_raw(self) -> Result<Response, Error>
Execute the instant query (using HTTP POST) and return the raw API response. Using a POST request is useful in the context of larger PromQL queries when the size of the final URL may break Prometheus’ or an intermediate proxies’ URL character limits.
Trait Implementations§
source§impl Clone for InstantQueryBuilder
impl Clone for InstantQueryBuilder
source§fn clone(&self) -> InstantQueryBuilder
fn clone(&self) -> InstantQueryBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more