mirror of
https://github.com/prometheus/prometheus
synced 2024-12-25 07:52:28 +00:00
backfill: Apply rule labels after query labels
Fix #9419 Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
parent
a18224d02d
commit
f8372bc6b9
@ -147,12 +147,18 @@ func (importer *ruleImporter) importRule(ctx context.Context, ruleExpr, ruleName
|
||||
matrix = val.(model.Matrix)
|
||||
|
||||
for _, sample := range matrix {
|
||||
lb := labels.NewBuilder(ruleLabels)
|
||||
lb := labels.NewBuilder(labels.Labels{})
|
||||
|
||||
for name, value := range sample.Metric {
|
||||
lb.Set(string(name), string(value))
|
||||
}
|
||||
|
||||
// Setting the rule labels after the output of the query,
|
||||
// so they can override query output.
|
||||
for _, l := range ruleLabels {
|
||||
lb.Set(l.Name, l.Value)
|
||||
}
|
||||
|
||||
lb.Set(labels.MetricName, ruleName)
|
||||
|
||||
for _, value := range sample.Values {
|
||||
|
Loading…
Reference in New Issue
Block a user