diff --git a/rules/manager.go b/rules/manager.go index 27cc78f981..16fb48104d 100644 --- a/rules/manager.go +++ b/rules/manager.go @@ -284,6 +284,8 @@ func (g *Group) offset() time.Duration { // Rules are matched based on their name. If there are duplicates, the // first is matched with the first, second with the second etc. func (g *Group) copyState(from *Group) { + g.evaluationTime = from.evaluationTime + ruleMap := make(map[string][]int, len(from.rules)) for fi, fromRule := range from.rules { diff --git a/rules/manager_test.go b/rules/manager_test.go index 30e38e9226..859118797c 100644 --- a/rules/manager_test.go +++ b/rules/manager_test.go @@ -266,6 +266,7 @@ func TestCopyState(t *testing.T) { map[string]labels.Labels{"r3a": nil}, map[string]labels.Labels{"r3b": nil}, }, + evaluationTime: time.Second, } oldGroup.rules[0].(*AlertingRule).active[42] = nil newGroup := &Group{ @@ -291,6 +292,7 @@ func TestCopyState(t *testing.T) { } testutil.Equals(t, want, newGroup.seriesInPreviousEval) testutil.Equals(t, oldGroup.rules[0], newGroup.rules[3]) + testutil.Equals(t, oldGroup.evaluationTime, newGroup.evaluationTime) } func TestUpdate(t *testing.T) {