Improve metrics

This commit is contained in:
Noah Hilverling 2019-05-29 10:49:39 +02:00
parent 5a70120d98
commit 887bbd59df
3 changed files with 6 additions and 7 deletions

View file

@ -295,7 +295,7 @@ func DeleteExecWorker(super *supervisor.Supervisor, objectInformation *configobj
super.ChErr <- super.Dbw.SqlBulkDelete(keys, objectInformation.BulkDeleteStmt)
rowLen := len(keys)
wg.Add(-rowLen)
ConfigSyncInsertsTotal.WithLabelValues(objectInformation.ObjectType).Add(float64(rowLen))
ConfigSyncDeletesTotal.WithLabelValues(objectInformation.ObjectType).Add(float64(rowLen))
}(keys)
}
}

View file

@ -5,10 +5,10 @@ import (
"github.com/prometheus/client_golang/prometheus/promauto"
)
var StateSyncsPerSecond = promauto.NewGaugeVec(
prometheus.GaugeOpts{
Name: "statesyncs_per_second",
Help: "Statesyncs per second per object type",
var StateSyncsTotal = promauto.NewCounterVec(
prometheus.CounterOpts{
Name: "statesyncs_total",
Help: "Statesyncs total per object type",
},
[]string{"objecttype"},
)

View file

@ -58,7 +58,6 @@ func syncStates(super *supervisor.Supervisor, objectType string) {
states := streams[0].Messages
if len(states) == 0 {
StateSyncsPerSecond.WithLabelValues(objectType).Set(0)
return
}
@ -131,7 +130,7 @@ func syncStates(super *supervisor.Supervisor, objectType string) {
log.Debugf("%d %s state synced", len(storedStateIds), objectType)
syncCounter[objectType] += len(storedStateIds)
StateSyncsPerSecond.WithLabelValues(objectType).Set(float64(len(storedStateIds)))
StateSyncsTotal.WithLabelValues(objectType).Add(float64(len(storedStateIds)))
}
//Converts a Icinga state type(0 for soft, 1 for hard) we got from Redis into a DB state type(soft, hard)