prometheus: Initialize all metrics

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
Julien Pivotto
2017-11-23 17:14:13 +01:00
parent 879ff838ae
commit 472663193a
3 changed files with 86 additions and 2 deletions

View File

@@ -16,7 +16,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// Package prometheus provides functions that are useful to control and manage
// the build-in prometheus instance.
// the built-in prometheus instance.
package prometheus
import (
@@ -170,6 +170,15 @@ func (obj *Prometheus) InitKindMetrics(kinds []string) error {
}
}
}
obj.managedResources.With(prometheus.Labels{"kind": kind})
failures := []string{"soft", "hard"}
for _, f := range failures {
failLabels := prometheus.Labels{"kind": kind, "failure": f}
obj.failedResourcesTotal.With(failLabels)
obj.failedResources.With(failLabels)
}
}
return nil
}