prometheus: Move the prometheus nil check inside the prometheus function

That pattern will be reused in future metrics.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
This commit is contained in:
Julien Pivotto
2017-02-26 08:46:21 +01:00
parent 50664fe115
commit 46260749c1
2 changed files with 6 additions and 5 deletions

View File

@@ -224,11 +224,9 @@ func (g *Graph) Process(v *Vertex) error {
// if this fails, don't UpdateTimestamp()
checkOK, err = obj.CheckApply(!noop)
if obj.Prometheus() != nil {
if promErr := obj.Prometheus().UpdateCheckApplyTotal(obj.Kind(), !noop, !checkOK, err != nil); promErr != nil {
// TODO: how to error correctly
log.Printf("%s[%s]: Prometheus.UpdateCheckApplyTotal() errored: %v", v.Kind(), v.GetName(), err)
}
if promErr := obj.Prometheus().UpdateCheckApplyTotal(obj.Kind(), !noop, !checkOK, err != nil); promErr != nil {
// TODO: how to error correctly
log.Printf("%s[%s]: Prometheus.UpdateCheckApplyTotal() errored: %v", v.Kind(), v.GetName(), err)
}
// TODO: Can the `Poll` converged timeout tracking be a
// more general method for all converged timeouts? this