pub struct RulesQueryBuilder { /* private fields */ }Expand description
Provides methods to build a query to the rules endpoint and send it to Prometheus.
Implementations§
Source§impl RulesQueryBuilder
Note that Prometheus combines all filters that have been set in the final request
and only returns rules that match all filters.
See the official documentation for a thorough explanation on the filters that can
be set: Prometheus API documentation.
impl RulesQueryBuilder
Note that Prometheus combines all filters that have been set in the final request
and only returns rules that match all filters.
See the official documentation for a thorough explanation on the filters that can
be set: Prometheus API documentation.
Sourcepub fn kind(self, kind: RuleKind) -> Self
pub fn kind(self, kind: RuleKind) -> Self
Set this to instruct Prometheus to only return a specific type of rule (either recording or alerting rules) instead of both. Calling this repeatedly will replace the current setting.
Sourcepub fn rule_names<T>(self, names: T) -> Self
pub fn rule_names<T>(self, names: T) -> Self
Pass rule names to instruct Prometheus to only return those rules whose names match one of them. This method can be called repeatedly and merge the names with those that have been set before.
Sourcepub fn rule_name(self, name: impl Display) -> Self
pub fn rule_name(self, name: impl Display) -> Self
Pass a rule name to instruct Prometheus to return rules that match this name. This method can be called repeatedly to extend the set of rule names that will be sent to Prometheus.
Sourcepub fn rule_groups<T>(self, groups: T) -> Self
pub fn rule_groups<T>(self, groups: T) -> Self
Pass group names to instruct Prometheus to only return those rules that are part of one of these groups. This method can be called repeatedly and merge the group names with those that have been set before.
Sourcepub fn rule_group(self, group: impl Display) -> Self
pub fn rule_group(self, group: impl Display) -> Self
Pass a group name to instruct Prometheus to return rules that are part of this group. This method can be called repeatedly to extend the set of group names that will be sent to Prometheus.
Sourcepub fn files<T>(self, files: T) -> Self
pub fn files<T>(self, files: T) -> Self
Pass file names to instruct Prometheus to only return those rules that are defined in one of those files. This method can be called repeatedly and merge the file names with those that have been set before.
Sourcepub fn file(self, file: impl Display) -> Self
pub fn file(self, file: impl Display) -> Self
Pass a file name to instruct Prometheus to return rules that are defined in this file. This method can be called repeatedly to extend the set of file names that will be sent to Prometheus.
Sourcepub fn exclude_alerts(self, exclude_alerts: bool) -> Self
pub fn exclude_alerts(self, exclude_alerts: bool) -> Self
Set this to instruct Prometheus to only return rules, but not active alerts. Calling this repeatedly will replace the current setting.
Sourcepub fn match_many<T>(self, selectors: T) -> Self
pub fn match_many<T>(self, selectors: T) -> Self
Only return rules that have configured labels that satisfy the label selectors.
This be used multiple times to extend the set of label selectors, in which case
rules that match any of the sets of label selectors are returned.
This corresponds to setting the match[] query parameter repeatedly.
Sourcepub fn match_one(self, selector: impl Display) -> Self
pub fn match_one(self, selector: impl Display) -> Self
Only return rules that have configured labels that satisfy the label selectors.
This be used multiple times to extend the set of label selectors, in which case
rules that match any of the sets of label selectors are returned.
This corresponds to setting the match[] query parameter once.