Пример #1
0
// initOnlineNodesGauge counts all nodes with status Online and initializes the
// OnlineNode Gauge with it. It also register a callback with the database to be notified
// of nodes going offline.
func initOnlineNodesGauge(store data.Nodeinfostore) {
	OnlineNodes.Set(0.0)
	for _, status := range store.GetNodeStatusInfos() {
		if status.Online {
			OnlineNodes.Inc()
		}
	}
	store.NotifyNodeOffline(decrementOnlineNodes)
}