Skip to content

Commit

Permalink
Add txsync counters
Browse files Browse the repository at this point in the history
  • Loading branch information
algorandskiy committed Nov 15, 2022
1 parent a12fe42 commit 5fd63cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions data/txHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ var transactionMessagesTxnLogicSig = metrics.MakeCounter(metrics.TransactionMess
var transactionMessagesTxnSigVerificationFailed = metrics.MakeCounter(metrics.TransactionMessagesTxnSigVerificationFailed)
var transactionMessagesBacklogSizeGauge = metrics.MakeGauge(metrics.TransactionMessagesBacklogSize)

var transactionGroupTxSyncRemember = metrics.MakeCounter(metrics.TransactionGroupTxSyncRemember)
var transactionGroupTxSyncAlreadyCommitted = metrics.MakeCounter(metrics.TransactionGroupTxSyncAlreadyCommitted)

// The txBacklogMsg structure used to track a single incoming transaction from the gossip network,
type txBacklogMsg struct {
rawmsg *network.IncomingMessage // the raw message from the network
Expand Down Expand Up @@ -343,6 +346,7 @@ func (handler *TxHandler) processDecoded(unverifiedTxGroup []transactions.Signed
unverifiedTxGroup: unverifiedTxGroup,
}
if handler.checkAlreadyCommitted(tx) {
transactionGroupTxSyncAlreadyCommitted.Inc(nil)
return network.OutgoingMessage{}, true
}

Expand Down Expand Up @@ -373,6 +377,8 @@ func (handler *TxHandler) processDecoded(unverifiedTxGroup []transactions.Signed
return network.OutgoingMessage{}, true
}

transactionGroupTxSyncRemember.Inc(nil)

// if we remembered without any error ( i.e. txpool wasn't full ), then we should pin these transactions.
err = handler.ledger.VerifiedTransactionCache().Pin(verifiedTxGroup)
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions util/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,9 @@ var (
TransactionMessagesTxnSigVerificationFailed = MetricName{Name: "algod_transaction_messages_sig_verify_failed", Description: "Number of transaction messages with signature verification failed"}
// TransactionMessagesBacklogSize "Number of transaction messages in the TX handler backlog queue"
TransactionMessagesBacklogSize = MetricName{Name: "algod_transaction_messages_backlog_size", Description: "Number of transaction messages in the TX handler backlog queue"}

// TransactionGroupTxSyncRemember "Number of transaction groups remembered via tx sync"
TransactionGroupTxSyncRemember = MetricName{Name: "algod_transaction_group_txsync_remember", Description: "Number of transaction groups remembered via txsync"}
// TransactionGroupTxSyncAlreadyCommitted "Number of duplicate or error transaction groups received via txsync"
TransactionGroupTxSyncAlreadyCommitted = MetricName{Name: "algod_transaction_group_txsync_already_committed", Description: "Number of duplicate or error transaction groups received via txsync"}
)

0 comments on commit 5fd63cb

Please sign in to comment.