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

WIP: Add metrics to TxPool #2321

Open
wants to merge 19 commits into
base: 807_add_more_metrics
Choose a base branch
from

Conversation

acerone85
Copy link
Contributor

@acerone85 acerone85 commented Oct 8, 2024

Linked Issues/PRs

Closes #1937

Description

  • Number of all transactions in pool
  • Number of immediately executable transactions in pool
  • Number of transactions pending verification
  • (Txs pending verification) how many tasks are created in sync processor
  • (Txs pending verification) and for how long they were active in the sync processor)
  • Size of transactions (when transaction is inserted (meaning: it was accepted for inclusion) - histogram)
  • Time to insert transaction (from when received until it is included in a block)
  • Select transaction for block (how long it took for the selection algorithm to select transactions)

TODO:

  • Enable metrics only if config.metrics = true

Checklist

  • Breaking changes are clearly marked as such in the PR description and changelog
  • New behavior is reflected in tests
  • The specification matches the implemented behavior (link update PR if changes are needed)

Before requesting review

  • I have reviewed the code myself
  • I have created follow-up issues caused by this PR and linked them here

After merging, notify other teams

[Add or remove entries as needed]

@rymnc
Copy link
Member

rymnc commented Oct 8, 2024

base branch should be master here 🏗️

@rafal-ch
Copy link
Contributor

rafal-ch commented Oct 8, 2024

please consider branching this from 807_add_more_metrics where we have some clean-up around histogram buckets creation

@acerone85 acerone85 changed the base branch from release/v0.37.0 to 807_add_more_metrics October 9, 2024 09:31
Comment on lines 25 to 36
vec![
1.0, 2.0, 3.0, 4.0, 5.0, 10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 120.0,
240.0, 480.0, 960.0, 1920.0, 3840.0,
]
.into_iter(),
);
let select_transaction_time_nanoseconds = Histogram::new(
vec![
10.0, 20.0, 30.0, 40.0, 50.0, 100.0, 200.0, 500.0, 1000.0, 2000.0,
5000.0, 10000.0, 50000.0, 100000.0, 500000.0,
]
.into_iter(),
Copy link
Contributor

Choose a reason for hiding this comment

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

We should move these to buckets.rs.

Copy link
Contributor

Choose a reason for hiding this comment

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

I moved this here and also created a bucket for transaction sizes here.

@@ -228,6 +228,16 @@ where
Ok(can_store_transaction)
}

fn record_transaction_time_in_txpool(tx: &StorageData) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, we need to remember to record these metrics only if config.metrics is true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is done in ed18ad1, although the workflow could be improved. Maybe having MetricsRecorder struct that wraps TxPoolMetrics and exposes the functions to record the metrics could work

@MitchTurner
Copy link
Member

Looking good. What things are left here?

@acerone85
Copy link
Contributor Author

Looking good. What things are left here?

I can do some minor improvements and add the changelog, but otherwise I think the only thing left here is to babysit the PR until https://github.com/FuelLabs/fuel-core/tree/807_add_more_metrics is merged and then this can be merged to master

rafal-ch and others added 2 commits October 14, 2024 16:55
If TxPool has a lot of events, it will interrupt the work of the timer.

### Before requesting review
- [x] I have reviewed the code myself

---------

Co-authored-by: AurelienFT <32803821+AurelienFT@users.noreply.github.com>
Co-authored-by: AurelienFT <aurefook@gmail.com>
rafal-ch and others added 3 commits October 14, 2024 17:32
This PR disables the flaky `test_poa_multiple_producers` test.

Follow-up issue: #2351

### Before requesting review
- [X] I have reviewed the code myself
- [X] I have created follow-up issues caused by this PR and linked them
here

---------

Co-authored-by: green <xgreenx9999@gmail.com>
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.

Add metrics for TxPool
5 participants