Alerting: Add rule conversion package (#100224)

This commit is contained in:
Alexander Akhmetov
2025-02-12 19:38:48 +02:00
committed by GitHub
parent e2a101cde3
commit 3cc4320aa9
6 changed files with 584 additions and 6 deletions
+25
View File
@@ -0,0 +1,25 @@
package prom
import (
prommodel "github.com/prometheus/common/model"
)
type PrometheusRulesFile struct {
Groups []PrometheusRuleGroup `yaml:"groups"`
}
type PrometheusRuleGroup struct {
Name string `yaml:"name"`
Interval prommodel.Duration `yaml:"interval"`
Rules []PrometheusRule `yaml:"rules"`
}
type PrometheusRule struct {
Alert string `yaml:"alert,omitempty"`
Expr string `yaml:"expr,omitempty"`
For *prommodel.Duration `yaml:"for,omitempty"`
KeepFiringFor *prommodel.Duration `yaml:"keep_firing_for,omitempty"`
Labels map[string]string `yaml:"labels,omitempty"`
Annotations map[string]string `yaml:"annotations,omitempty"`
Record string `yaml:"record,omitempty"`
}