mirror of
https://github.com/prometheus/prometheus
synced 2024-12-25 07:52:28 +00:00
Copy over rule group duration on reload.
This is currently getting lost, this will soon be in a metric and we don't want it dropping to 0 on every reload.
This commit is contained in:
parent
aa370fa568
commit
0a42a9fc8f
@ -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 {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user