diff --git a/snap/snapshotter.go b/snap/snapshotter.go index 764cc63ab72..57d7d320c5e 100644 --- a/snap/snapshotter.go +++ b/snap/snapshotter.go @@ -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