Merge pull request #6 from linhvo/entropy

add entropy statsD
This commit is contained in:
Michael Baird 2017-04-25 10:43:49 -05:00 committed by GitHub
commit 6cacf5d0dc
2 changed files with 6 additions and 1 deletions

View file

@ -1376,11 +1376,11 @@ func (s *FragmentSyncer) SyncFragment() error {
if byteSlicesEqual(checksums) {
continue
}
// Synchronize block.
if err := s.syncBlock(blockID); err != nil {
return fmt.Errorf("sync block: id=%d, err=%s", blockID, err)
}
s.Fragment.stats.Count("BlockRepair", 1)
}
return nil

View file

@ -171,6 +171,7 @@ func (s *Server) Addr() net.Addr {
func (s *Server) logger() *log.Logger { return log.New(s.LogOutput, "", log.LstdFlags) }
func (s *Server) monitorAntiEntropy() {
t := time.Now()
ticker := time.NewTicker(s.AntiEntropyInterval)
defer ticker.Stop()
@ -182,6 +183,7 @@ func (s *Server) monitorAntiEntropy() {
case <-s.closing:
return
case <-ticker.C:
s.Holder.Stats.Count("AntiEntropy", 1)
}
s.logger().Printf("holder sync beginning")
@ -199,9 +201,12 @@ func (s *Server) monitorAntiEntropy() {
continue
}
// Record successful sync in log.
s.logger().Printf("holder sync complete")
}
dif := time.Since(t)
s.Holder.Stats.Histogram("AntiEntropyDuration", float64(dif))
}
// monitorMaxSlices periodically pulls the highest slice from each node in the cluster.