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

feat(txpool): add sub-pools length and size metrics #2598

Merged

Conversation

leovct
Copy link
Contributor

@leovct leovct commented May 7, 2023

Description

Add pool and sub-pools (pending, basefee and queued) length and size metrics.
Closes #2592

Test

  • TODO

@leovct leovct marked this pull request as draft May 7, 2023 10:01
@codecov-commenter
Copy link

codecov-commenter commented May 7, 2023

Codecov Report

Merging #2598 (8422775) into main (3591a6f) will decrease coverage by 32.05%.
The diff coverage is 7.69%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@             Coverage Diff             @@
##             main    #2598       +/-   ##
===========================================
- Coverage   71.43%   39.39%   -32.05%     
===========================================
  Files         496      496               
  Lines       62509    62612      +103     
===========================================
- Hits        44656    24665    -19991     
- Misses      17853    37947    +20094     
Flag Coverage Δ
integration-tests ?
unit-tests 39.39% <7.69%> (-26.89%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
crates/transaction-pool/src/metrics.rs 100.00% <ø> (ø)
crates/transaction-pool/src/pool/txpool.rs 48.60% <0.00%> (-11.42%) ⬇️
crates/transaction-pool/src/test_utils/mod.rs 94.44% <100.00%> (ø)

... and 296 files with indirect coverage changes

@leovct leovct force-pushed the leovct/feat-add-more-txpool-metrics branch from 9fae21f to 51625f7 Compare May 7, 2023 16:25
@onbjerg onbjerg added A-tx-pool Related to the transaction mempool A-observability Related to tracing, metrics, logs and other observability tools labels May 8, 2023
Copy link
Member

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

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

Some of the metrics are redundant since Prometheus is more than capable of adding up different series to infer these metrics, so we should eliminate them.

My other comments are mostly around naming; the names themselves don't matter too much but we should avoid terms like "length" and we should be somewhat consistent in the naming of the metrics

Thanks for taking this on!

crates/transaction-pool/src/metrics.rs Outdated Show resolved Hide resolved
crates/transaction-pool/src/metrics.rs Outdated Show resolved Hide resolved
crates/transaction-pool/src/metrics.rs Outdated Show resolved Hide resolved
crates/transaction-pool/src/metrics.rs Outdated Show resolved Hide resolved
crates/transaction-pool/src/metrics.rs Outdated Show resolved Hide resolved
crates/transaction-pool/src/metrics.rs Outdated Show resolved Hide resolved
crates/transaction-pool/src/metrics.rs Outdated Show resolved Hide resolved
crates/transaction-pool/src/metrics.rs Outdated Show resolved Hide resolved
Comment on lines 261 to 269
let stats = self.size();
self.metrics.total_number_transactions.set(stats.total_transactions as f64);
self.metrics.total_size_bytes.set(stats.total_size as f64);
self.metrics.pending_pool_length.set(stats.pending as f64);
self.metrics.pending_sub_pool_size_bytes.set(stats.pending_size as f64);
self.metrics.basefee_pool_length.set(stats.basefee as f64);
self.metrics.basefee_sub_pool_size_bytes.set(stats.basefee_size as f64);
self.metrics.queued_pool_length.set(stats.queued as f64);
self.metrics.queued_sub_pool_size_bytes.set(stats.queued_size as f64);
Copy link
Member

Choose a reason for hiding this comment

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

I guess this is ok cc @mattsse

Copy link
Collaborator

Choose a reason for hiding this comment

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

this seems ok!
looks correct

@leovct leovct marked this pull request as ready for review May 9, 2023 08:27
@leovct
Copy link
Contributor Author

leovct commented May 9, 2023

Some of the metrics are redundant since Prometheus is more than capable of adding up different series to infer these metrics, so we should eliminate them.

My other comments are mostly around naming; the names themselves don't matter too much but we should avoid terms like "length" and we should be somewhat consistent in the naming of the metrics

Thanks for taking this on!

Thanks for the review @onbjerg, it's very instructive! :)
I renamed the metrics, removed the ones that can be inferred and updated the documentation.

@leovct leovct changed the title feat(txpool): add pool and sub-pools length and size metrics feat(txpool): add sub-pools length and size metrics May 9, 2023
@mattsse mattsse force-pushed the leovct/feat-add-more-txpool-metrics branch from d9a2ce1 to 8422775 Compare May 9, 2023 12:39
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lgtm

@mattsse mattsse merged commit c0cbb6a into paradigmxyz:main May 9, 2023
@leovct leovct deleted the leovct/feat-add-more-txpool-metrics branch May 9, 2023 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-observability Related to tracing, metrics, logs and other observability tools A-tx-pool Related to the transaction mempool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add more txpool metrics
4 participants