mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Improve metrics
This commit is contained in:
parent
5a70120d98
commit
887bbd59df
3 changed files with 6 additions and 7 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue