From cbbbd6e70ab7c60da020ce118830c014c909be1d Mon Sep 17 00:00:00 2001 From: Marco Pracucci Date: Mon, 29 Jan 2024 10:21:57 +0100 Subject: [PATCH] Remove superfluous nil check in Group.metrics Signed-off-by: Marco Pracucci --- rules/group.go | 5 ++--- rules/manager_test.go | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rules/group.go b/rules/group.go index 56648a60c..5ee06dc0b 100644 --- a/rules/group.go +++ b/rules/group.go @@ -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) } diff --git a/rules/manager_test.go b/rules/manager_test.go index 7d5a2bd9f..07ec06104 100644 --- a/rules/manager_test.go +++ b/rules/manager_test.go @@ -679,6 +679,7 @@ func TestDeletedRuleMarkedStale(t *testing.T) { Appendable: st, RuleConcurrencyController: sequentialRuleEvalController{}, }, + metrics: NewGroupMetrics(nil), } newGroup.CopyState(oldGroup)