示例#1
0
func getCurrentNodeStat(mresp *stats.MessageResponse) {
	if currentStat, err := stats.GetStats(*flName); err == nil {
		log.Debug("Current stat:", currentStat)

		mresp.Nodes[*flName] = currentStat
	} else {
		log.Error("Failed to get node stats:", err)
		mresp.Error = err.Error()
	}
}
示例#2
0
func getAllNodesStats(mresp *stats.MessageResponse) {
	if len(globalNodes) == 0 {
		return
	}

	if allStats, err := collect(); err == nil {
		for _, nodeStat := range allStats {
			mresp.Nodes[nodeStat.Name] = nodeStat
		}
	} else {
		mresp.Error = err.Error()
	}
}