Skip to content

Commit

Permalink
snap: Record the snapshot save duration on success rather than only o…
Browse files Browse the repository at this point in the history
…n error.

It makes more sense to record the latency of successes (or all attempts)
than of only a particular failure case.
  • Loading branch information
a-robinson committed Jul 16, 2015
1 parent ebbb0ca commit 57a5520
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion snap/snapshotter.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (s *Snapshotter) save(snapshot *raftpb.Snapshot) error {
return err
}
err = ioutil.WriteFile(path.Join(s.dir, fname), d, 0666)
if err != nil {
if err == nil {
saveDurations.Observe(float64(time.Since(start).Nanoseconds() / int64(time.Microsecond)))
}
return err
Expand Down

0 comments on commit 57a5520

Please sign in to comment.