|
|
@@ -123,14 +123,29 @@ func main() {
|
|
|
select {
|
|
|
case <-ctx.Done():
|
|
|
wg.Wait()
|
|
|
- printFinal(logger, &sent, &failed, &dupes, &rlHits, &rttHist)
|
|
|
+ var tsent, tfailed, tdupes, trlHits uint64
|
|
|
+ for i := range results {
|
|
|
+ tsent += results[i].sent
|
|
|
+ tfailed += results[i].failed
|
|
|
+ tdupes += results[i].dupes
|
|
|
+ trlHits += results[i].rlHits
|
|
|
+ }
|
|
|
+ printFinal(logger, tsent, tfailed, tdupes, trlHits, &rttHist)
|
|
|
return
|
|
|
case <-ticker.C:
|
|
|
+ // Aggregate per-worker counters.
|
|
|
+ var tsent, tfailed, tdupes, trlHits uint64
|
|
|
+ for i := range results {
|
|
|
+ tsent += results[i].sent
|
|
|
+ tfailed += results[i].failed
|
|
|
+ tdupes += results[i].dupes
|
|
|
+ trlHits += results[i].rlHits
|
|
|
+ }
|
|
|
logger.Info("progress",
|
|
|
- "sent", sent.Load(),
|
|
|
- "failed", failed.Load(),
|
|
|
- "dupes", dupes.Load(),
|
|
|
- "rate_limited", rlHits.Load(),
|
|
|
+ "sent", tsent,
|
|
|
+ "failed", tfailed,
|
|
|
+ "dupes", tdupes,
|
|
|
+ "rate_limited", trlHits,
|
|
|
)
|
|
|
}
|
|
|
}
|
|
|
@@ -396,12 +411,12 @@ func runMetrics(addr, clusterID, instance string, sent, failed, dupes, rlHits *a
|
|
|
_ = srv.ListenAndServe()
|
|
|
}
|
|
|
|
|
|
-func printFinal(logger *slog.Logger, sent, failed, dupes, rlHits *atomic.Uint64, rttHist *atomicHistogram) {
|
|
|
+func printFinal(logger *slog.Logger, sent, failed, dupes, rlHits uint64, rttHist *atomicHistogram) {
|
|
|
logger.Info("done",
|
|
|
- "sent", sent.Load(),
|
|
|
- "failed", failed.Load(),
|
|
|
- "dupes", dupes.Load(),
|
|
|
- "rate_limited", rlHits.Load(),
|
|
|
+ "sent", sent,
|
|
|
+ "failed", failed,
|
|
|
+ "dupes", dupes,
|
|
|
+ "rate_limited", rlHits,
|
|
|
"rtt", rttHist.String(),
|
|
|
)
|
|
|
}
|