Browse Source

wal: document, clean up fsync histogram

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
Gyuho Lee 7 years ago
parent
commit
b0b966c43c
2 changed files with 8 additions and 5 deletions
  1. 7 4
      wal/metrics.go
  2. 1 1
      wal/wal.go

+ 7 - 4
wal/metrics.go

@@ -17,15 +17,18 @@ package wal
 import "github.com/prometheus/client_golang/prometheus"
 import "github.com/prometheus/client_golang/prometheus"
 
 
 var (
 var (
-	syncDurations = prometheus.NewHistogram(prometheus.HistogramOpts{
+	walFsyncSec = prometheus.NewHistogram(prometheus.HistogramOpts{
 		Namespace: "etcd",
 		Namespace: "etcd",
 		Subsystem: "disk",
 		Subsystem: "disk",
 		Name:      "wal_fsync_duration_seconds",
 		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() {
 func init() {
-	prometheus.MustRegister(syncDurations)
+	prometheus.MustRegister(walFsyncSec)
 }
 }

+ 1 - 1
wal/wal.go

@@ -590,7 +590,7 @@ func (w *WAL) sync() error {
 			plog.Warningf("sync duration of %v, expected less than %v", took, warnSyncDuration)
 			plog.Warningf("sync duration of %v, expected less than %v", took, warnSyncDuration)
 		}
 		}
 	}
 	}
-	syncDurations.Observe(took.Seconds())
+	walFsyncSec.Observe(took.Seconds())
 
 
 	return err
 	return err
 }
 }