From 5fd63cb1dcb7efe96cedf90066dcae4a672011b4 Mon Sep 17 00:00:00 2001 From: Pavel Zbitskiy Date: Mon, 14 Nov 2022 21:26:38 -0500 Subject: [PATCH] Add txsync counters --- data/txHandler.go | 6 ++++++ util/metrics/metrics.go | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/data/txHandler.go b/data/txHandler.go index 7b2112454a..5d60a5cf34 100644 --- a/data/txHandler.go +++ b/data/txHandler.go @@ -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 @@ -343,6 +346,7 @@ func (handler *TxHandler) processDecoded(unverifiedTxGroup []transactions.Signed unverifiedTxGroup: unverifiedTxGroup, } if handler.checkAlreadyCommitted(tx) { + transactionGroupTxSyncAlreadyCommitted.Inc(nil) return network.OutgoingMessage{}, true } @@ -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 { diff --git a/util/metrics/metrics.go b/util/metrics/metrics.go index 86d5211029..91ff056854 100644 --- a/util/metrics/metrics.go +++ b/util/metrics/metrics.go @@ -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"} )