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

go-algorand 3.13.1-stable Release PR #4915

Merged
merged 11 commits into from
Dec 15, 2022
Prev Previous commit
Next Next commit
metrics: split alive check counter between early/dead (#4898)
  • Loading branch information
cce authored Dec 13, 2022
commit 2d1edd42b0a34c00de91b809b3c98bbfaa711380
1 change: 1 addition & 0 deletions data/pools/transactionPool.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ func (pool *TransactionPool) addToPendingBlockEvaluatorOnce(txgroup []transactio
Round: r,
FirstValid: tx.Txn.FirstValid,
LastValid: tx.Txn.LastValid,
Early: false,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions data/transactions/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type TxnDeadError struct {
Round basics.Round
FirstValid basics.Round
LastValid basics.Round
Early bool
}

func (err *TxnDeadError) Error() string {
Expand Down
1 change: 1 addition & 0 deletions data/transactions/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ func (tx Header) Alive(tc TxnContext) error {
Round: round,
FirstValid: tx.FirstValid,
LastValid: tx.LastValid,
Early: round < tx.FirstValid,
}
}

Expand Down
17 changes: 13 additions & 4 deletions data/txHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ var transactionGroupTxSyncAlreadyCommitted = metrics.MakeCounter(metrics.Transac

var transactionMessageTxPoolRememberCounter = metrics.NewTagCounter(
"algod_transaction_messages_txpool_remember_{TAG}", "Number of transaction messages not remembered by txpool b/c if {TAG}",
txPoolRememberTagCap, txPoolRememberPendingEval, txPoolRememberTagNoSpace, txPoolRememberTagFee, txPoolRememberTagTxnDead, txPoolRememberTagTooLarge, txPoolRememberTagGroupID,
txPoolRememberTagCap, txPoolRememberPendingEval, txPoolRememberTagNoSpace, txPoolRememberTagFee, txPoolRememberTagTxnDead, txPoolRememberTagTxnEarly, txPoolRememberTagTooLarge, txPoolRememberTagGroupID,
txPoolRememberTagTxID, txPoolRememberTagLease, txPoolRememberTagTxIDEval, txPoolRememberTagLeaseEval, txPoolRememberTagEvalGeneric,
)

var transactionMessageTxPoolCheckCounter = metrics.NewTagCounter(
"algod_transaction_messages_txpool_check_{TAG}", "Number of transaction messages that didn't pass check by txpool b/c if {TAG}",
txPoolRememberTagTxnNotWellFormed, txPoolRememberTagTxnDead, txPoolRememberTagTooLarge, txPoolRememberTagGroupID,
txPoolRememberTagTxnNotWellFormed, txPoolRememberTagTxnDead, txPoolRememberTagTxnEarly, txPoolRememberTagTooLarge, txPoolRememberTagGroupID,
txPoolRememberTagTxID, txPoolRememberTagLease, txPoolRememberTagTxIDEval, txPoolRememberTagLeaseEval, txPoolRememberTagEvalGeneric,
)

Expand All @@ -85,6 +85,7 @@ const (
txPoolRememberTagNoSpace = "no_space"
txPoolRememberTagFee = "fee"
txPoolRememberTagTxnDead = "txn_dead"
txPoolRememberTagTxnEarly = "txn_early"
txPoolRememberTagTooLarge = "too_large"
txPoolRememberTagGroupID = "groupid"
txPoolRememberTagTxID = "txid"
Expand Down Expand Up @@ -290,7 +291,11 @@ func (handler *TxHandler) checkReportErrors(err error) {
transactionMessageTxPoolCheckCounter.Add(txPoolRememberTagTxnNotWellFormed, 1)
return
case *transactions.TxnDeadError:
transactionMessageTxPoolCheckCounter.Add(txPoolRememberTagTxnDead, 1)
if err.Early {
transactionMessageTxPoolCheckCounter.Add(txPoolRememberTagTxnEarly, 1)
} else {
transactionMessageTxPoolCheckCounter.Add(txPoolRememberTagTxnDead, 1)
}
return
case *ledgercore.TransactionInLedgerError:
if err.InBlockEvaluator {
Expand Down Expand Up @@ -348,7 +353,11 @@ func (handler *TxHandler) rememberReportErrors(err error) {
transactionMessageTxPoolRememberCounter.Add(txPoolRememberTagFee, 1)
return
case *transactions.TxnDeadError:
transactionMessageTxPoolRememberCounter.Add(txPoolRememberTagTxnDead, 1)
if err.Early {
transactionMessageTxPoolRememberCounter.Add(txPoolRememberTagTxnEarly, 1)
} else {
transactionMessageTxPoolRememberCounter.Add(txPoolRememberTagTxnDead, 1)
}
return
case *ledgercore.TransactionInLedgerError:
if err.InBlockEvaluator {
Expand Down
12 changes: 11 additions & 1 deletion data/txHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1763,9 +1763,19 @@ func TestTxHandlerRememberReportErrorsWithTxPool(t *testing.T) {
handler.postProcessCheckedTxn(&wi)
require.Equal(t, 1, getMetricCounter(txPoolRememberTagEvalGeneric))

// trigger TxnDeadErr from the evaluator
// trigger TxnDeadErr from the evaluator for "early" case
txn2 = txn1
txn2.FirstValid = ledger.LastRound() + 10
prevTxnEarly := getMetricCounter(txPoolRememberTagTxnEarly)
wi.unverifiedTxGroup = []transactions.SignedTxn{txn2.Sign(secrets[0])}
handler.postProcessCheckedTxn(&wi)
require.Equal(t, prevTxnEarly+1, getMetricCounter(txPoolRememberTagTxnEarly))
handler.checkAlreadyCommitted(&wi)
require.Equal(t, 1, getCheckMetricCounter(txPoolRememberTagTxnEarly))

// trigger TxnDeadErr from the evaluator for "late" case
txn2 = txn1
txn2.LastValid = 0
prevTxnDead := getMetricCounter(txPoolRememberTagTxnDead)
wi.unverifiedTxGroup = []transactions.SignedTxn{txn2.Sign(secrets[0])}
handler.postProcessCheckedTxn(&wi)
Expand Down