github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/kv/kvserver/batcheval/result/metrics.go (about) 1 // Copyright 2014 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 package result 12 13 // Metrics tracks various counters related to command applications and 14 // their outcomes. 15 type Metrics struct { 16 LeaseRequestSuccess int // lease request evaluated successfully 17 LeaseRequestError int // lease request error at evaluation time 18 LeaseTransferSuccess int // lease transfer evaluated successfully 19 LeaseTransferError int // lease transfer error at evaluation time 20 ResolveCommit int // intent commit evaluated successfully 21 ResolveAbort int // non-poisoning intent abort evaluated successfully 22 ResolvePoison int // poisoning intent abort evaluated successfully 23 } 24 25 // Add absorbs the supplied Metrics into the receiver. 26 func (mt *Metrics) Add(o Metrics) { 27 mt.LeaseRequestSuccess += o.LeaseRequestSuccess 28 mt.LeaseRequestError += o.LeaseRequestError 29 mt.LeaseTransferSuccess += o.LeaseTransferSuccess 30 mt.LeaseTransferError += o.LeaseTransferError 31 mt.ResolveCommit += o.ResolveCommit 32 mt.ResolveAbort += o.ResolveAbort 33 mt.ResolvePoison += o.ResolvePoison 34 }