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

Txpool metrics update #2385

Merged
merged 21 commits into from
Oct 31, 2024
Merged

Txpool metrics update #2385

merged 21 commits into from
Oct 31, 2024

Conversation

rafal-ch
Copy link
Contributor

@rafal-ch rafal-ch commented Oct 23, 2024

Linked Issues/PRs

This PR addresses the outstanding comments to the TxPool metrics PR: #2321

Description

There are a couple of changes to how and when metrics are registered and some histogram buckets are redefined.

Additionally there is also a small clean-up of the changelog file.

Before requesting review

  • I have reviewed the code myself

@rafal-ch rafal-ch requested a review from acerone85 October 23, 2024 14:04
@rafal-ch rafal-ch marked this pull request as ready for review October 23, 2024 14:04
@rafal-ch rafal-ch requested a review from AurelienFT October 23, 2024 14:18
CHANGELOG.md Outdated
@@ -6,18 +6,24 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Added
- [2321](https://github.com/FuelLabs/fuel-core/pull/2321): New metrics for the txpool:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this mention both #2321 and #2385?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should. I wanted to keep the "one PR per line" rule, so this is how I have changed it:
dadaaa6

acerone85
acerone85 previously approved these changes Oct 24, 2024
Copy link
Contributor

@acerone85 acerone85 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

AurelienFT
AurelienFT previously approved these changes Oct 25, 2024
Copy link
Contributor

@AurelienFT AurelienFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines 432 to 435
if metrics {
record_tx_size(&checked_tx)
let size = checked_tx.metered_bytes_size();
txpool_metrics().tx_size.observe(size as f64);
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to record the size of inserted transaction or size of all transactions that entered the pool? If the first one, then maybe it makes sense to move this metric into TxPool::insert function. If the second, then we need to do it along with .number_of_transactions_pending_verification.inc().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, we're interested in logging transactions that has been inserted into the TxPool, meaning: every transaction that passed all validations and is actually being inserted.

Other cases (i.e. log rejected transactions) are still to be handled, as per the original issue: #1937 - this will be delivered as a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tx_size metric is now recorded the moment it is actually accepted and inserted into the TxPool: fbb0a54

@rafal-ch rafal-ch dismissed stale reviews from AurelienFT and acerone85 via 800e651 October 30, 2024 09:17
xgreenx
xgreenx previously approved these changes Oct 30, 2024
@@ -76,6 +62,44 @@ fn initialize_buckets() -> HashMap<Buckets, Vec<f64>> {
256.0 * 1024.0,
]
),
(
Buckets::TransactionInsertionTimeInThreadPool,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not for this PR, but I think having the name of the buckets implying their use is not optimal. That said, we discussed this already and IIRC we could not find a good naming convention :)

@rafal-ch rafal-ch enabled auto-merge (squash) October 31, 2024 11:52
@rafal-ch rafal-ch merged commit 676ca8f into master Oct 31, 2024
36 of 53 checks passed
@rafal-ch rafal-ch deleted the txpool_metrics_update branch October 31, 2024 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants