Add container to monitor in runtime

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2017-03-21 13:08:49 -07:00
parent f36feb2ed4
commit 155185c2b2
4 changed files with 30 additions and 4 deletions

View file

@ -152,7 +152,11 @@ func (n *Namespace) NewDesc(name, help string, unit Unit, labels ...string) *pro
if string(unit) != "" {
name = fmt.Sprintf("%s_%s", name, unit)
}
name = fmt.Sprintf("%s_%s_%s", n.name, n.subsystem, name)
namespace := n.name
if n.subsystem != "" {
namespace = fmt.Sprintf("%s_%s", namespace, n.subsystem)
}
name = fmt.Sprintf("%s_%s", namespace, name)
return prometheus.NewDesc(name, help, labels, prometheus.Labels(n.labels))
}