pub struct InstantQueryBuilder { /* private fields */ }Expand description
A builder object used to set some query parameters in the context of an instant query before sending the query on its way.
Implementations
sourceimpl 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 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.
Trait Implementations
sourceimpl Clone for InstantQueryBuilder
impl Clone for InstantQueryBuilder
sourcefn clone(&self) -> InstantQueryBuilder
fn clone(&self) -> InstantQueryBuilder
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
Auto Trait Implementations
impl !RefUnwindSafe for InstantQueryBuilder
impl Send for InstantQueryBuilder
impl Sync for InstantQueryBuilder
impl Unpin for InstantQueryBuilder
impl !UnwindSafe for InstantQueryBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more