-
Notifications
You must be signed in to change notification settings - Fork 474
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
txHandler: add more metric #4786
Conversation
e808ea4
to
f79a445
Compare
network/wsNetwork.go
Outdated
if request.tags[i] == protocol.ProposalPayloadTag { | ||
networkPrioPPNonCompressedSize.AddUint64(uint64(len(d)), nil) | ||
} | ||
messageTags[request.tags[i]] = struct{}{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get it, what is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is for correcting the PP metric. without it it counts all prio messages, not only PP
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cce what other metrics we want to collect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some changes seem not related to adding the metric.
data/txHandler.go
Outdated
@@ -146,6 +154,7 @@ func (handler *TxHandler) backlogWorker() { | |||
return | |||
} | |||
if handler.checkAlreadyCommitted(wi) { | |||
transactionMessagesDupPreBacklog.Inc(nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor note: a duplicate may be detected here because the node got the transactions through the pool sync.
Although the txSync transactions also go through the txHandler, they don't get check for duplication through this code path.
I am not saying this is wrong, I just wanted to put out some more information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I was just looking at txSyncer.go and noticed it doesn't have any counters, and neither does the txHandler.processDecoded() call it makes when it adds txns from txSyncer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is fine, we want to count duplicates from tx handler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also want to add some counters for how often txSyncer is actually putting txns in the pool (or even counting their failures too), which seems to be happening more often than we think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added AlreadyCommitted and Remembered counters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Some comments maybe for other considerations.
e22e1f2
to
f234c96
Compare
Codecov Report
@@ Coverage Diff @@
## master #4786 +/- ##
==========================================
- Coverage 54.67% 54.67% -0.01%
==========================================
Files 416 416
Lines 53596 53662 +66
==========================================
+ Hits 29306 29340 +34
- Misses 21860 21895 +35
+ Partials 2430 2427 -3
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
c6f47ac
to
81b53c1
Compare
81b53c1
to
a12fe42
Compare
589fb23
to
5fd63cb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one tweak? Should we have a counter for 'other reason'? otherwise good.
I wish we didn't make new definitions of constants like algod_transaction_messages_already_committed
in util/metrics instead of in the place they're used, but I recognize it matches the established pattern for that source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
96d46e5
@brianolson @algonautshant renamed |
data/transactions/verify/txn.go
Outdated
if prepErr != nil { | ||
// re-wrap the error, take underlying one and copy the reason code | ||
err = &ErrTxGroupError{ | ||
err: fmt.Errorf("transaction %+v invalid : %w", stxn, prepErr.err), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think txnBatchPrep is already returning ErrTxGroupError, maybe you would just want to keep the error it created (not make a new one), which preserves .Reason, and set .err on it to have this wrapped fmt?
@@ -185,6 +246,8 @@ func (handler *TxHandler) postprocessCheckedTxn(wi *txBacklogMsg) { | |||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to break out any of the errors where Remember() fails? Remember failing is transactionMessagesHandled - transactionMessagesRemember so we already know the total
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow-up: will do in separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. However, many of the added code is not covered by tests.
if prio { | ||
if request.tags[i] == protocol.ProposalPayloadTag { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary to make two levels of if?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we want containsPrioPPTag
@@ -185,6 +246,8 @@ func (handler *TxHandler) postprocessCheckedTxn(wi *txBacklogMsg) { | |||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
follow-up: will do in separate PR
Summary
Add more metrics to tx handler to better understand txn traffic:
Test Plan
Added unit tests