pub struct TargetMetadataQueryBuilder<'a> { /* private fields */ }
Expand description
Provides methods to build a query to the target metadata endpoint and send it to Prometheus.
Implementations§
source§impl<'a> TargetMetadataQueryBuilder<'a>
impl<'a> TargetMetadataQueryBuilder<'a>
Note that Prometheus combines all filters that have been set in the final request
and only returns target metadata that matches all filters.
See the official documentation for a thorough explanation on the filters that can
be set: Prometheus API documentation.
sourcepub fn match_target(self, selector: &'a Selector<'a>) -> Self
pub fn match_target(self, selector: &'a Selector<'a>) -> Self
Pass a label selector to instruct Prometheus to filter targets by their label sets. Calling this repeatedly will replace the current label selector.
sourcepub fn metric(self, metric: impl Display) -> Self
pub fn metric(self, metric: impl Display) -> Self
Set this to only retrieve target metadata for this metric. Calling this repeatedly will replace the current metric name.
sourcepub fn limit(self, limit: i32) -> Self
pub fn limit(self, limit: i32) -> Self
Limit the maximum number of targets to match. Calling this repeatedly will replace the current limit.
sourcepub async fn get(self) -> Result<Vec<TargetMetadata>, Error>
pub async fn get(self) -> Result<Vec<TargetMetadata>, Error>
Execute the target metadata query (using HTTP GET) and return the collection of
TargetMetadata
sent by Prometheus.
Trait Implementations§
source§impl<'a> Clone for TargetMetadataQueryBuilder<'a>
impl<'a> Clone for TargetMetadataQueryBuilder<'a>
source§fn clone(&self) -> TargetMetadataQueryBuilder<'a>
fn clone(&self) -> TargetMetadataQueryBuilder<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more