Add error metric for stress tests

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2017-12-13 13:15:07 -05:00
parent 652e078078
commit 6ae0f5f7e2

View File

@ -18,13 +18,17 @@ import (
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
var ct metrics.LabeledTimer var (
ct metrics.LabeledTimer
errCounter metrics.LabeledCounter
)
func init() { func init() {
ns := metrics.NewNamespace("stress", "", nil) ns := metrics.NewNamespace("stress", "", nil)
// if you want more fine grained metrics then you can drill down with the metrics in prom that // if you want more fine grained metrics then you can drill down with the metrics in prom that
// containerd is outputing // containerd is outputing
ct = ns.NewLabeledTimer("run", "Run time of a full container during the test", "commit") ct = ns.NewLabeledTimer("run", "Run time of a full container during the test", "commit")
errCounter = ns.NewLabeledCounter("errors", "Errors encountered running the stress tests", "err")
metrics.Register(ns) metrics.Register(ns)
} }
@ -62,6 +66,7 @@ func (w *worker) run(ctx, tctx context.Context) {
!strings.Contains(err.Error(), context.DeadlineExceeded.Error()) { !strings.Contains(err.Error(), context.DeadlineExceeded.Error()) {
w.failures++ w.failures++
logrus.WithError(err).Errorf("running container %s", id) logrus.WithError(err).Errorf("running container %s", id)
errCounter.WithValues(err.Error()).Inc()
} }
continue continue