Skip to content

Commit

Permalink
Merge pull request #8054 from heyitsanthony/txn-metric
Browse files Browse the repository at this point in the history
mvcc: count range/put/del operations for txns
  • Loading branch information
heyitsanthony committed Jun 8, 2017
2 parents 8f8f79d + 0352ce7 commit 3df9352
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions mvcc/metrics_txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

0 comments on commit 3df9352

Please sign in to comment.