Add binary sizes to stress test metrics
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
00bc24fcea
commit
0725b60402
@ -23,6 +23,22 @@ import (
|
|||||||
|
|
||||||
const imageName = "docker.io/library/alpine:latest"
|
const imageName = "docker.io/library/alpine:latest"
|
||||||
|
|
||||||
|
var (
|
||||||
|
ct metrics.LabeledTimer
|
||||||
|
errCounter metrics.LabeledCounter
|
||||||
|
binarySizeGauge metrics.LabeledGauge
|
||||||
|
)
|
||||||
|
|
||||||
|
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")
|
||||||
|
binarySizeGauge = ns.NewLabeledGauge("binary_size", "Binary size of compiled binaries", "name")
|
||||||
|
errCounter = ns.NewLabeledCounter("errors", "Errors encountered running the stress tests", "err")
|
||||||
|
metrics.Register(ns)
|
||||||
|
}
|
||||||
|
|
||||||
type run struct {
|
type run struct {
|
||||||
total int
|
total int
|
||||||
failures int
|
failures int
|
||||||
@ -152,6 +168,7 @@ func serve(c config) error {
|
|||||||
logrus.WithError(err).Error("listen and serve")
|
logrus.WithError(err).Error("listen and serve")
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
checkBinarySizes()
|
||||||
return test(c)
|
return test(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
26
cmd/containerd-stress/size.go
Normal file
26
cmd/containerd-stress/size.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
var binaries = []string{
|
||||||
|
"ctr",
|
||||||
|
"containerd",
|
||||||
|
"containerd-shim",
|
||||||
|
}
|
||||||
|
|
||||||
|
// checkBinarySizes checks and reports the binary sizes for the containerd compiled binaries to prometheus
|
||||||
|
func checkBinarySizes() {
|
||||||
|
for _, name := range binaries {
|
||||||
|
fi, err := os.Stat(filepath.Join("/usr/local/bin", name))
|
||||||
|
if err != nil {
|
||||||
|
logrus.WithError(err).Error("stat binary")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
binarySizeGauge.WithValues(name).Set(float64(fi.Size()))
|
||||||
|
}
|
||||||
|
}
|
@ -13,25 +13,10 @@ import (
|
|||||||
"github.com/containerd/containerd"
|
"github.com/containerd/containerd"
|
||||||
"github.com/containerd/containerd/cio"
|
"github.com/containerd/containerd/cio"
|
||||||
"github.com/containerd/containerd/oci"
|
"github.com/containerd/containerd/oci"
|
||||||
metrics "github.com/docker/go-metrics"
|
|
||||||
specs "github.com/opencontainers/runtime-spec/specs-go"
|
specs "github.com/opencontainers/runtime-spec/specs-go"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
type worker struct {
|
type worker struct {
|
||||||
id int
|
id int
|
||||||
wg *sync.WaitGroup
|
wg *sync.WaitGroup
|
||||||
|
Loading…
Reference in New Issue
Block a user