cmd/promtool: return errors from rule evaluations (#5483)

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
Simon Pasquier 2019-04-23 09:59:03 +02:00 committed by Brian Brazil
parent f2ca36e56a
commit 31a2d14e2f

View file

@ -210,6 +210,12 @@ func (tg *testGroup) test(mint, maxt time.Time, evalInterval time.Duration, grou
} }
for _, g := range groups { for _, g := range groups {
g.Eval(suite.Context(), ts) g.Eval(suite.Context(), ts)
for _, r := range g.Rules() {
if r.LastError() != nil {
errs = append(errs, errors.Errorf(" rule: %s, time: %s, err: %v",
r.Name(), ts.Sub(time.Unix(0, 0)), r.LastError()))
}
}
} }
}) })
if len(errs) > 0 { if len(errs) > 0 {