Versions in this module Expand all Collapse all v0 v0.0.310 Jun 15, 2022 Changes in this version + const CustomRuleResourceLabelKeyLevel + const ErrGenRuleId + const LabelKeyAlertType + const LabelKeyInternalRuleDuration + const LabelKeyInternalRuleGroup + const LabelKeyInternalRuleName + const LabelKeyInternalRuleQuery + const LabelKeyPrometheusReplica + const LabelKeyRuleId + const LabelKeyThanosRulerReplica + const LabelValueAlertType + func FormatDuration(for_ string) (string, error) + func FormatExpr(expr string) (string, error) + func GenEndpointRuleId(group string, epRule *alerting.AlertingRule, ...) (string, error) + func GenResourceRuleIdIgnoreFormat(group string, rule *promresourcesv1.Rule) string + func GetAlertingRuleStatus(ruleNamespace string, rule *ResourceRule, epRuleGroups []*alerting.RuleGroup, ...) (*v2alpha1.GettableAlertingRule, error) + func GetAlertingRulesStatus(ruleNamespace string, ruleChunk *ResourceRuleChunk, ...) ([]*v2alpha1.GettableAlertingRule, error) + func InjectExprNamespaceLabel(expr, namespace string) (string, error) + func ParseAlertingRules(epRuleGroups []*alerting.RuleGroup, custom bool, level v2alpha1.RuleLevel, ...) ([]*v2alpha1.GettableAlertingRule, error) + type PrometheusRuler struct + func (r *PrometheusRuler) AddAlertingRules(ctx context.Context, ruleNamespace *corev1.Namespace, ...) ([]*v2alpha1.BulkItemResponse, error) + func (r *PrometheusRuler) DeleteAlertingRules(ctx context.Context, ruleNamespace *corev1.Namespace, ...) ([]*v2alpha1.BulkItemResponse, error) + func (r *PrometheusRuler) ExternalLabels() func() map[string]string + func (r *PrometheusRuler) ListRuleResources(ruleNamespace *corev1.Namespace, extraRuleResourceSelector labels.Selector) ([]*promresourcesv1.PrometheusRule, error) + func (r *PrometheusRuler) Namespace() string + func (r *PrometheusRuler) RuleResourceNamespaceSelector() (labels.Selector, error) + func (r *PrometheusRuler) RuleResourceSelector(extraRuleResourceSelector labels.Selector) (labels.Selector, error) + func (r *PrometheusRuler) UpdateAlertingRules(ctx context.Context, ruleNamespace *corev1.Namespace, ...) ([]*v2alpha1.BulkItemResponse, error) + type ResourceRule struct + Custom bool + Level v2alpha1.RuleLevel + type ResourceRuleChunk struct + Custom bool + Level v2alpha1.RuleLevel + ResourceRulesMap map[string]*ResourceRuleCollection + type ResourceRuleCollection struct + GroupSet map[string]struct{} + IdRules map[string]*ResourceRuleItem + NameRules map[string][]*ResourceRuleItem + type ResourceRuleItem struct + ResourceName string + type RuleCache struct + func NewRuleCache(ruleResourceInformer prominformersv1.PrometheusRuleInformer) *RuleCache + func (c *RuleCache) GetRule(ruler Ruler, ruleNamespace *corev1.Namespace, ...) (*ResourceRuleItem, error) + func (c *RuleCache) GetRuleByIdOrName(ruler Ruler, ruleNamespace *corev1.Namespace, ...) ([]*ResourceRuleItem, error) + func (c *RuleCache) ListRules(ruler Ruler, ruleNamespace *corev1.Namespace, ...) (map[string]*ResourceRuleCollection, error) + type RuleWithGroup struct + Group string + Id string + type Ruler interface + AddAlertingRules func(ctx context.Context, ruleNamespace *corev1.Namespace, ...) ([]*v2alpha1.BulkItemResponse, error) + DeleteAlertingRules func(ctx context.Context, ruleNamespace *corev1.Namespace, ...) ([]*v2alpha1.BulkItemResponse, error) + ExternalLabels func() func() map[string]string + ListRuleResources func(ruleNamespace *corev1.Namespace, extraRuleResourceSelector labels.Selector) ([]*promresourcesv1.PrometheusRule, error) + Namespace func() string + RuleResourceNamespaceSelector func() (labels.Selector, error) + RuleResourceSelector func(extraRuleResourceSelector labels.Selector) (labels.Selector, error) + UpdateAlertingRules func(ctx context.Context, ruleNamespace *corev1.Namespace, ...) ([]*v2alpha1.BulkItemResponse, error) + func NewPrometheusRuler(resource *promresourcesv1.Prometheus, ...) Ruler + func NewThanosRuler(resource *promresourcesv1.ThanosRuler, ...) Ruler + type ThanosRuler struct + func (r *ThanosRuler) AddAlertingRules(ctx context.Context, ruleNamespace *corev1.Namespace, ...) ([]*v2alpha1.BulkItemResponse, error) + func (r *ThanosRuler) DeleteAlertingRules(ctx context.Context, ruleNamespace *corev1.Namespace, ...) ([]*v2alpha1.BulkItemResponse, error) + func (r *ThanosRuler) ExternalLabels() func() map[string]string + func (r *ThanosRuler) ListRuleResources(ruleNamespace *corev1.Namespace, extraRuleSelector labels.Selector) ([]*promresourcesv1.PrometheusRule, error) + func (r *ThanosRuler) Namespace() string + func (r *ThanosRuler) RuleResourceNamespaceSelector() (labels.Selector, error) + func (r *ThanosRuler) RuleResourceSelector(extraRuleSelector labels.Selector) (labels.Selector, error) + func (r *ThanosRuler) UpdateAlertingRules(ctx context.Context, ruleNamespace *corev1.Namespace, ...) ([]*v2alpha1.BulkItemResponse, error)