// initTotalClientsGauge iterates over all statistics // and sums up the clients if all online nodes. func initTotalClientsGauge(store data.Nodeinfostore) { TotalClientCounter.Set(0.0) var totalClients int = 0 for _, stats := range store.GetAllStatistics() { status, err := store.GetNodeStatusInfo(stats.NodeId) if err != nil { log.WithFields(log.Fields{ "error": err, "nodeId": stats.NodeId, }).Warn("Didn't found node status in store") } if status.Online { totalClients = totalClients + stats.Clients.Total TotalClientCounter.Add(float64(stats.Clients.Total)) } else { log.Debugf("Node %s was offline", status.NodeId) } } }