diff --git a/cmd/containerd-stress/main.go b/cmd/containerd-stress/main.go index 3b2b030fb..a53ca6e77 100644 --- a/cmd/containerd-stress/main.go +++ b/cmd/containerd-stress/main.go @@ -192,6 +192,10 @@ func test(c config) error { if c.Exec { args = oci.WithProcessArgs("sleep", "10") } + v, err := client.Version(ctx) + if err != nil { + return err + } // create the workers along with their spec for i := 0; i < c.Concurrency; i++ { wg.Add(1) @@ -210,6 +214,7 @@ func test(c config) error { image: image, client: client, doExec: c.Exec, + commit: v.Revision, } workers = append(workers, w) } diff --git a/cmd/containerd-stress/worker.go b/cmd/containerd-stress/worker.go index a66148220..0386b3daa 100644 --- a/cmd/containerd-stress/worker.go +++ b/cmd/containerd-stress/worker.go @@ -18,13 +18,13 @@ import ( "github.com/sirupsen/logrus" ) -var ct metrics.Timer +var ct metrics.LabeledTimer 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.NewTimer("run", "Run time of a full container during the test") + ct = ns.NewLabeledTimer("run", "Run time of a full container during the test", "commit") metrics.Register(ns) } @@ -38,6 +38,7 @@ type worker struct { image containerd.Image spec *specs.Spec doExec bool + commit string } func (w *worker) run(ctx, tctx context.Context) { @@ -66,7 +67,7 @@ func (w *worker) run(ctx, tctx context.Context) { continue } // only log times are success so we don't scew the results from failures that go really fast - ct.UpdateSince(start) + ct.WithValues(w.commit).UpdateSince(start) } }