Skip to content

Commit

Permalink
Add error metric for stress tests
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
  • Loading branch information
crosbymichael committed Dec 13, 2017
1 parent 652e078 commit 6ae0f5f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/containerd-stress/worker.go
Expand Up @@ -18,13 +18,17 @@ import (
"github.com/sirupsen/logrus"
)

var ct metrics.LabeledTimer
var (
ct metrics.LabeledTimer
errCounter metrics.LabeledCounter
)

func init() {
ns := metrics.NewNamespace("stress", "", nil)
// if you want more fine grained metrics then you can drill down with the metrics in prom that
// containerd is outputing
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)
}

Expand Down Expand Up @@ -62,6 +66,7 @@ func (w *worker) run(ctx, tctx context.Context) {
!strings.Contains(err.Error(), context.DeadlineExceeded.Error()) {
w.failures++
logrus.WithError(err).Errorf("running container %s", id)
errCounter.WithValues(err.Error()).Inc()

}
continue
Expand Down

0 comments on commit 6ae0f5f

Please sign in to comment.