Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics: split out /Transaction/AssembleBlock metrics #4795

Merged
merged 6 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address review feedback
  • Loading branch information
iansuvak committed Nov 16, 2022
commit b6b079f195b2afd767d998b5f03f21398669269d
10 changes: 5 additions & 5 deletions data/pools/transactionPool.go
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,6 @@ func (pool *TransactionPool) recomputeBlockEvaluator(committedTxIds map[transact
pool.assemblyMu.Unlock()

next := bookkeeping.MakeBlock(prev)
proto := config.Consensus[next.CurrentProtocol]
pool.numPendingWholeBlocks = 0
hint := pendingCount - int(knownCommitted)
if hint < 0 || int(knownCommitted) < 0 {
Expand Down Expand Up @@ -738,14 +737,15 @@ func (pool *TransactionPool) recomputeBlockEvaluator(committedTxIds map[transact
for _, tx := range txgroup {
pool.statusCache.put(tx, err.Error())
}

switch err := err.(type) {
// metrics here are duplicated for historic reasons. stats is hardly used and should be removed in favor of asmstats
switch terr := err.(type) {
case *ledgercore.TransactionInLedgerError:
asmStats.CommittedCount++
stats.RemovedInvalidCount++
case transactions.TxnDeadError:
if proto.MaxTxnLife == uint64(err.LastValid-err.FirstValid) {
asmStats.ExpiredMaxLifeCount++
if int(terr.LastValid-terr.FirstValid) > 20 {
// cutoff value here is picked as a somewhat arbitrary cutoff trying to separate longer lived transactions from very short lived ones
asmStats.ExpiredLongLivedCount++
}
asmStats.ExpiredCount++
stats.ExpiredCount++
Expand Down
4 changes: 2 additions & 2 deletions logging/telemetryspec/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type AssembleBlockStats struct {
InvalidCount int // number of transaction groups that are included in a block
MinFeeErrorCount int // number of transactions excluded because the fee is too low
ExpiredCount int // number of transactions removed because of expiration
ExpiredMaxLifeCount int // number of expired transactions with LastValid set to MaxTxnLife
ExpiredLongLivedCount int // number of expired transactions with non-super short LastValid values
LeaseErrorCount int // number of transactions removed because it has an already used lease
MinFee uint64
MaxFee uint64
Expand Down Expand Up @@ -106,7 +106,7 @@ func (m AssembleBlockStats) String() string {
b.WriteString(fmt.Sprintf("InvalidCount:%d, ", m.InvalidCount))
b.WriteString(fmt.Sprintf("MinFeeErrorCount:%d, ", m.MinFeeErrorCount))
b.WriteString(fmt.Sprintf("ExpiredCount:%d, ", m.ExpiredCount))
b.WriteString(fmt.Sprintf("ExpiredMaxLifeCount:%d, ", m.ExpiredMaxLifeCount))
b.WriteString(fmt.Sprintf("ExpiredLongLivedCount:%d, ", m.ExpiredLongLivedCount))
b.WriteString(fmt.Sprintf("LeaseErrorCount:%d, ", m.LeaseErrorCount))
b.WriteString(fmt.Sprintf("MinFee:%d, ", m.MinFee))
b.WriteString(fmt.Sprintf("MaxFee:%d, ", m.MaxFee))
Expand Down