Remove superfluous nil check in Group.metrics

Signed-off-by: Marco Pracucci <marco@pracucci.com>
pull/12946/head
Marco Pracucci 2024-01-29 10:21:57 +01:00
parent 046cd7599f
commit cbbbd6e70a
No known key found for this signature in database
GPG Key ID: 74C1BD403D2DF9B5
2 changed files with 3 additions and 3 deletions

View File

@ -592,9 +592,8 @@ func (g *Group) Eval(ctx context.Context, ts time.Time) {
}
wg.Wait()
if g.metrics != nil {
g.metrics.GroupSamples.WithLabelValues(GroupKey(g.File(), g.Name())).Set(samplesTotal.Load())
}
g.metrics.GroupSamples.WithLabelValues(GroupKey(g.File(), g.Name())).Set(samplesTotal.Load())
g.cleanupStaleSeries(ctx, ts)
}

View File

@ -679,6 +679,7 @@ func TestDeletedRuleMarkedStale(t *testing.T) {
Appendable: st,
RuleConcurrencyController: sequentialRuleEvalController{},
},
metrics: NewGroupMetrics(nil),
}
newGroup.CopyState(oldGroup)