Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/pkg/ruler/rulespb/custom.go

21 lines
608 B

package rulespb
import "github.com/prometheus/prometheus/model/rulefmt"
// RuleGroupList contains a set of rule groups
type RuleGroupList []*RuleGroupDesc
// Formatted returns the rule group list as a set of formatted rule groups mapped
// by namespace
func (l RuleGroupList) Formatted() map[string][]rulefmt.RuleGroup {
ruleMap := map[string][]rulefmt.RuleGroup{}
for _, g := range l {
if _, exists := ruleMap[g.Namespace]; !exists {
ruleMap[g.Namespace] = []rulefmt.RuleGroup{FromProto(g)}
continue
}
ruleMap[g.Namespace] = append(ruleMap[g.Namespace], FromProto(g))
}
return ruleMap
}