From 6ae0f5f7e2ab0e9762c3fdaa4aa176002258fdbb Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Wed, 13 Dec 2017 13:15:07 -0500 Subject: [PATCH] Add error metric for stress tests Signed-off-by: Michael Crosby --- cmd/containerd-stress/worker.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/containerd-stress/worker.go b/cmd/containerd-stress/worker.go index 0386b3daa..2738555ab 100644 --- a/cmd/containerd-stress/worker.go +++ b/cmd/containerd-stress/worker.go @@ -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) } @@ -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