pub struct RangeQueryBuilder { /* private fields */ }Expand description
Provides a builder to set some query parameters in the context of a range query before sending it to Prometheus.
Implementations§
Source§impl RangeQueryBuilder
See the official documentation for a thorough explanation on the filters that can
be set: Prometheus API documentation.
impl RangeQueryBuilder
See the official documentation for a thorough explanation on the filters that can be set: Prometheus API documentation.
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Set the evaluation timeout. Must be positive. If this is not set the timeout will default to the value of the “-query.timeout” flag of the Prometheus server.
Sourcepub fn limit(self, limit: i64) -> Self
pub fn limit(self, limit: i64) -> Self
Set maximum number of returned series. 0 means disabled.
Sourcepub fn lookback_delta(self, duration: Duration) -> Self
pub fn lookback_delta(self, duration: Duration) -> Self
Override the lookback period just for this query.
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 range 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 range 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.