Add config for exporting container metrics to prom
This adds an option for the cgroups monitor to include container metrics in the prometheus output. We will have to use the plugin to emit oom events via the events service but when the `no_prom` setting is set for the plugin container metrics will not be included in the prom output. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -19,12 +19,18 @@ func NewOOMCollector(ns *metrics.Namespace) (*OOMCollector, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var desc *prometheus.Desc
|
||||
if ns != nil {
|
||||
desc = ns.NewDesc("memory_oom", "The number of times a container has received an oom event", metrics.Total, "container_id", "namespace")
|
||||
}
|
||||
c := &OOMCollector{
|
||||
fd: fd,
|
||||
desc: ns.NewDesc("memory_oom", "The number of times a container has received an oom event", metrics.Total, "container_id", "namespace"),
|
||||
desc: desc,
|
||||
set: make(map[uintptr]*oom),
|
||||
}
|
||||
ns.Add(c)
|
||||
if ns != nil {
|
||||
ns.Add(c)
|
||||
}
|
||||
go c.start()
|
||||
return c, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user