From 0352ce79b8a9c9e3d2abca32458c804b197e00cb Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Wed, 7 Jun 2017 16:53:50 -0700 Subject: [PATCH] mvcc: count range/put/del operations for txns Txns were previously only bumping the txn counter; now bumps all operation counters. --- mvcc/metrics_txn.go | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/mvcc/metrics_txn.go b/mvcc/metrics_txn.go index fd2144279ae..911d64875d7 100644 --- a/mvcc/metrics_txn.go +++ b/mvcc/metrics_txn.go @@ -50,18 +50,10 @@ func (tw *metricsTxnWrite) Put(key, value []byte, lease lease.LeaseID) (rev int6 func (tw *metricsTxnWrite) End() { defer tw.TxnWrite.End() - if sum := tw.ranges + tw.puts + tw.deletes; sum != 1 { - if sum > 1 { - txnCounter.Inc() - } - return - } - switch { - case tw.ranges == 1: - rangeCounter.Inc() - case tw.puts == 1: - putCounter.Inc() - case tw.deletes == 1: - deleteCounter.Inc() + if sum := tw.ranges + tw.puts + tw.deletes; sum > 1 { + txnCounter.Inc() } + rangeCounter.Add(float64(tw.ranges)) + putCounter.Add(float64(tw.puts)) + deleteCounter.Add(float64(tw.deletes)) }