From 26eb3ac2f87b20c6fbac2b13eac3f130e9fb70b7 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Tue, 12 Jan 2016 10:26:06 +0100 Subject: [PATCH 1/2] Don't skip recording rule errors --- rules/recording.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rules/recording.go b/rules/recording.go index 070b43820..698a08323 100644 --- a/rules/recording.go +++ b/rules/recording.go @@ -55,6 +55,10 @@ func (rule RecordingRule) eval(timestamp model.Time, engine *promql.Engine) (mod result = query.Exec() vector model.Vector ) + if result.Err != nil { + return nil, err + } + switch result.Value.(type) { case model.Vector: vector, err = result.Vector() From 6eee86dce80e26160543aa75985036f581ff4226 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Tue, 12 Jan 2016 10:52:40 +0100 Subject: [PATCH 2/2] Terminate rule groups during initial sleep When an evaluation group runs initially, it waits a deterministic amount of time. During that time it also has to accept a termination singnal so shutdown doesn't hang during the first evaluation iteration after a configuration reload. Fixes #1307 --- rules/manager.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rules/manager.go b/rules/manager.go index 84eb0697e..212c9f9e5 100644 --- a/rules/manager.go +++ b/rules/manager.go @@ -123,7 +123,11 @@ func (g *Group) run() { defer close(g.terminated) // Wait an initial amount to have consistently slotted intervals. - time.Sleep(g.offset()) + select { + case <-time.After(g.offset()): + case <-g.done: + return + } iter := func() { start := time.Now()