Skip to content

Commit

Permalink
wal: document, clean up fsync histogram
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <[email protected]>
  • Loading branch information
gyuho committed May 23, 2018
1 parent 058663d commit 0427018
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions wal/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@ package wal
import "github.com/prometheus/client_golang/prometheus"

var (
syncDurations = prometheus.NewHistogram(prometheus.HistogramOpts{
walFsyncSec = prometheus.NewHistogram(prometheus.HistogramOpts{
Namespace: "etcd",
Subsystem: "disk",
Name: "wal_fsync_duration_seconds",
Help: "The latency distributions of fsync called by wal.",
Buckets: prometheus.ExponentialBuckets(0.001, 2, 14),
Help: "The latency distributions of fsync called by WAL.",

// lowest bucket start of upper bound 0.001 sec (1 ms) with factor 2
// highest bucket start of 0.001 sec * 2^13 == 8.192 sec
Buckets: prometheus.ExponentialBuckets(0.001, 2, 14),
})
)

func init() {
prometheus.MustRegister(syncDurations)
prometheus.MustRegister(walFsyncSec)
}
2 changes: 1 addition & 1 deletion wal/wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ func (w *WAL) sync() error {
plog.Warningf("sync duration of %v, expected less than %v", took, warnSyncDuration)
}
}
syncDurations.Observe(took.Seconds())
walFsyncSec.Observe(took.Seconds())

return err
}
Expand Down

0 comments on commit 0427018

Please sign in to comment.