Add commit to stress metric
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
		| @@ -192,6 +192,10 @@ func test(c config) error { | |||||||
| 	if c.Exec { | 	if c.Exec { | ||||||
| 		args = oci.WithProcessArgs("sleep", "10") | 		args = oci.WithProcessArgs("sleep", "10") | ||||||
| 	} | 	} | ||||||
|  | 	v, err := client.Version(ctx) | ||||||
|  | 	if err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
| 	// create the workers along with their spec | 	// create the workers along with their spec | ||||||
| 	for i := 0; i < c.Concurrency; i++ { | 	for i := 0; i < c.Concurrency; i++ { | ||||||
| 		wg.Add(1) | 		wg.Add(1) | ||||||
| @@ -210,6 +214,7 @@ func test(c config) error { | |||||||
| 			image:  image, | 			image:  image, | ||||||
| 			client: client, | 			client: client, | ||||||
| 			doExec: c.Exec, | 			doExec: c.Exec, | ||||||
|  | 			commit: v.Revision, | ||||||
| 		} | 		} | ||||||
| 		workers = append(workers, w) | 		workers = append(workers, w) | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -18,13 +18,13 @@ import ( | |||||||
| 	"github.com/sirupsen/logrus" | 	"github.com/sirupsen/logrus" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| var ct metrics.Timer | var ct metrics.LabeledTimer | ||||||
|  |  | ||||||
| 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.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) | 	metrics.Register(ns) | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -38,6 +38,7 @@ type worker struct { | |||||||
| 	image  containerd.Image | 	image  containerd.Image | ||||||
| 	spec   *specs.Spec | 	spec   *specs.Spec | ||||||
| 	doExec bool | 	doExec bool | ||||||
|  | 	commit string | ||||||
| } | } | ||||||
|  |  | ||||||
| func (w *worker) run(ctx, tctx context.Context) { | func (w *worker) run(ctx, tctx context.Context) { | ||||||
| @@ -66,7 +67,7 @@ func (w *worker) run(ctx, tctx context.Context) { | |||||||
| 			continue | 			continue | ||||||
| 		} | 		} | ||||||
| 		// only log times are success so we don't scew the results from failures that go really fast | 		// 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) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Crosby
					Michael Crosby