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: add additional message type metrics to EthRequestHandlerMetrics #8319

Merged
merged 3 commits into from
May 20, 2024

Conversation

vcshih
Copy link
Contributor

@vcshih vcshih commented May 20, 2024

Resolves #8245

Adds additional metrics for when GetNodeData and GetReceipts eth requests are received. Also normalizes the Counter metric names to better follow convention as mentioned in #8150. Let me know if these metric names make sense or if there are any further suggestions.

I tried to look for ways to test this, but I didn't see any tests for metrics handling in this file. Would love to add some if it is helpful and if they are tested some other way in the codebase that I can use for guidance.

Copy link
Member

@emhane emhane left a comment

Choose a reason for hiding this comment

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

lgtm

@Rjected
Copy link
Member

Rjected commented May 20, 2024

I tried to look for ways to test this, but I didn't see any tests for metrics handling in this file

We don't have good ways to test metrics, but luckily most of the time they are supposed to be very simple, and easy to observe once we have grafana dashboards for them. Not having tests for these metrics should be fine

Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

these would be my naming suggestions - my rule of thumb for naming is:

  • field names should be terse, and
  • documentation should be descriptive and thorough

as field / variable names that are too long (even if descriptive) can be confusing, since they are not supposed to be read as sentences

Comment on lines 316 to 323
/// Number of GetReceipts requests received
pub(crate) eth_requests_get_receipts_received_total: Counter,

/// Number of GetBlockBodies requests received
pub(crate) eth_requests_get_block_bodies_received_total: Counter,

/// Number of GetNodeData requests received
pub(crate) eth_requests_get_node_data_received_total: Counter,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// Number of GetReceipts requests received
pub(crate) eth_requests_get_receipts_received_total: Counter,
/// Number of GetBlockBodies requests received
pub(crate) eth_requests_get_block_bodies_received_total: Counter,
/// Number of GetNodeData requests received
pub(crate) eth_requests_get_node_data_received_total: Counter,
/// Number of GetReceipts requests received
pub(crate) eth_receipt_requests_received: Counter,
/// Number of GetBlockBodies requests received
pub(crate) eth_bodies_requests_received: Counter,
/// Number of GetNodeData requests received
pub(crate) eth_node_data_requests_received: Counter,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good with respect to the name changes. I have mostly accepted these changes in 9e9abdd with slight modification:

  1. added _total to all these metrics to align with issue Counter metric name should adhere to *_total pattern #8150 for consistency across the codebase
  2. eth_receipt_requests_received -> eth_receipts_requests_received_total to align casing with the other metrics

let me know if this is good and thanks for the comments 👍

Copy link
Member

Choose a reason for hiding this comment

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

makes sense!

/// Number of received headers requests
pub(crate) received_headers_requests: Counter,
/// Number of GetBlockHeaders requests received
pub(crate) eth_requests_get_block_headers_received_total: Counter,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pub(crate) eth_requests_get_block_headers_received_total: Counter,
pub(crate) eth_headers_requests_received: Counter,

@vcshih vcshih requested a review from Rjected May 20, 2024 18:54
Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@Rjected Rjected added this pull request to the merge queue May 20, 2024
Merged via the queue into paradigmxyz:main with commit 5943c47 May 20, 2024
28 checks passed
mw2000 pushed a commit to mw2000/reth that referenced this pull request Jun 5, 2024
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.

eth message type metrics
3 participants