Switch to Timing helper function

This commit is contained in:
Alan Bernstein 2020-04-10 09:00:11 -05:00 committed by Matt Jaffee
parent 2423ecf8d5
commit df2503dfa6
No known key found for this signature in database
GPG key ID: 08A3DFFF987B11BF
3 changed files with 4 additions and 4 deletions

View file

@ -2249,7 +2249,7 @@ func (f *fragment) Snapshot() error {
func track(start time.Time, message string, stats stats.StatsClient, logger logger.Logger) {
elapsed := time.Since(start)
logger.Debugf("%s took %s", message, elapsed)
stats.Histogram(MetricSnapshotDurationSeconds, elapsed.Seconds(), 1.0)
stats.Timing(MetricSnapshotDurationSeconds, elapsed, 1.0)
}
// snapshot does the actual snapshot operation. it does not check or care

View file

@ -801,10 +801,10 @@ func (s *holderSyncer) SyncHolder() error {
}
}
}
s.Stats.Histogram(MetricSyncFieldDurationSeconds, float64(time.Since(tf)), 1.0)
s.Stats.Timing(MetricSyncFieldDurationSeconds, time.Since(tf), 1.0)
tf = time.Now() // reset tf
}
s.Stats.Histogram(MetricSyncIndexDurationSeconds, float64(time.Since(ti)), 1.0)
s.Stats.Timing(MetricSyncIndexDurationSeconds, time.Since(ti), 1.0)
ti = time.Now() // reset ti
}

View file

@ -675,7 +675,7 @@ func (s *Server) monitorAntiEntropy() {
// Record successful sync in log.
s.logger.Printf("holder sync complete")
dif := time.Since(t)
s.holder.Stats.Histogram(MetricAntiEntropyDurationSeconds, float64(dif), 1.0)
s.holder.Stats.Timing(MetricAntiEntropyDurationSeconds, dif, 1.0)
// Drain tick channel since we just finished anti-entropy. If the AE
// process took a long time, we don't want them to pile up on each