rules: add evaluationTimestamp when copy state. (#7775)
Signed-off-by: johncming <johncming@yahoo.com>
This commit is contained in:
parent
5a7d398d19
commit
362080ba28
|
@ -500,6 +500,7 @@ func nameAndLabels(rule Rule) string {
|
||||||
// first is matched with the first, second with the second etc.
|
// first is matched with the first, second with the second etc.
|
||||||
func (g *Group) CopyState(from *Group) {
|
func (g *Group) CopyState(from *Group) {
|
||||||
g.evaluationDuration = from.evaluationDuration
|
g.evaluationDuration = from.evaluationDuration
|
||||||
|
g.evaluationTimestamp = from.evaluationTimestamp
|
||||||
|
|
||||||
ruleMap := make(map[string][]int, len(from.rules))
|
ruleMap := make(map[string][]int, len(from.rules))
|
||||||
|
|
||||||
|
|
|
@ -657,6 +657,7 @@ func TestCopyState(t *testing.T) {
|
||||||
testutil.Equals(t, want, newGroup.seriesInPreviousEval)
|
testutil.Equals(t, want, newGroup.seriesInPreviousEval)
|
||||||
testutil.Equals(t, oldGroup.rules[0], newGroup.rules[3])
|
testutil.Equals(t, oldGroup.rules[0], newGroup.rules[3])
|
||||||
testutil.Equals(t, oldGroup.evaluationDuration, newGroup.evaluationDuration)
|
testutil.Equals(t, oldGroup.evaluationDuration, newGroup.evaluationDuration)
|
||||||
|
testutil.Equals(t, oldGroup.evaluationTimestamp, newGroup.evaluationTimestamp)
|
||||||
testutil.Equals(t, []labels.Labels{{{Name: "l1", Value: "v3"}}}, newGroup.staleSeries)
|
testutil.Equals(t, []labels.Labels{{{Name: "l1", Value: "v3"}}}, newGroup.staleSeries)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue