From b0b966c43c3a54c0eece63d315584f0fe876791b Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Wed, 23 May 2018 13:48:29 -0700 Subject: [PATCH] wal: document, clean up fsync histogram Signed-off-by: Gyuho Lee --- wal/metrics.go | 11 +++++++---- wal/wal.go | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/wal/metrics.go b/wal/metrics.go index 9e089d380..22cb8003c 100644 --- a/wal/metrics.go +++ b/wal/metrics.go @@ -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) } diff --git a/wal/wal.go b/wal/wal.go index 49d450584..7f653fbc2 100644 --- a/wal/wal.go +++ b/wal/wal.go @@ -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 }