report nodeCount.

pull/69/head
Richard Liu 6 years ago
parent 8c5bab09df
commit 91f53904cb
  1. 9
      consensus/consensus_leader.go

@ -414,14 +414,15 @@ func (consensus *Consensus) reportTPS(numOfTxs int32) {
"timeElapsed", timeElapsed, "timeElapsed", timeElapsed,
"TPS", tps, "TPS", tps,
"consensus", consensus) "consensus", consensus)
reportMetrics(numOfTxs, tps) consensus.reportMetrics(numOfTxs, tps)
} }
func reportMetrics(numOfTxs int32, tps float64) { func (consensus *Consensus) reportMetrics(numOfTxs int32, tps float64) {
URL := "http://localhost:3000/report" URL := "http://localhost:3000/report"
form := url.Values{ form := url.Values{
"tps": {strconv.FormatFloat(tps, 'f', 2, 64)}, "tps": {strconv.FormatFloat(tps, 'f', 2, 64)},
"txCount": {strconv.Itoa(int(numOfTxs))}, "txCount": {strconv.Itoa(int(numOfTxs))},
"nodeCount": {strconv.Itoa(len(consensus.validators) + 1)},
} }
body := bytes.NewBufferString(form.Encode()) body := bytes.NewBufferString(form.Encode())

Loading…
Cancel
Save