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

Features/unified p2p message metrics #6835

Merged
merged 13 commits into from
Mar 21, 2024

Conversation

asdacap
Copy link
Contributor

@asdacap asdacap commented Mar 15, 2024

  • As requested, metrics for all p2p messages.

  • Automatically have metrics for all p2p message type, incoming and outgoing, count and bytes. Dashboard would look like this:
    Screenshot_2024-03-16_03-42-32

  • Uses four metric with two label each. Example rate(nethermind_incoming_p2p_messages{protocol="snap1",message="GetAccountRange"}[$__rate_interval])

    • nethermind_incoming_p2p_messages
    • nethermind_incoming_p2p_message_bytes
    • nethermind_outgoing_p2p_messages
    • nethermind_outgoing_p2p_message_bytes.
  • Like any other labeled metric, can sum them by protocol or message.

  • Actually, should message be message_type? or type? No sure. Let me know if anyone have any preference.

  • Deprecate a bunch of metrics that is now redundant.

Changes

  • Add four new metrics that is labeled with the protocol and message type.

Types of changes

What types of changes does your code introduce?

  • New feature (a non-breaking change that adds functionality)

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

  • Seems to work.

Documentation

Requires documentation update

  • Yes
  • No

Requires explanation in Release Notes

  • Yes
  • No
- Deprecated per message type p2p metric in favour of unified metric for all p2p message. These metrics will be removed on next release.
  - `nethermind_*_sent`
  - `nethermind_*_received`.
Please use:
 - `nethermind_incoming_p2p_messages`
 - `nethermind_outgoing_p2p_messages`.

Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

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

Cool idea, but I really don't like translating those dictionaries all the time.

I think better idea would be to create struct Protocol with protocol name and version and maybe even struct Message with Protocol+MessageName.

We could avoid allocations, while writing to Metrics dictionary in the first place and then later have the conversion on ToString method, which would be cached of course.

Question: We could use similar generic metrics for JSON RPC?

@asdacap
Copy link
Contributor Author

asdacap commented Mar 18, 2024

What kind of struct and what is it used for?
Yes, this can be done for JSON Rpc also.

@asdacap asdacap merged commit dc4c50a into master Mar 21, 2024
67 checks passed
@asdacap asdacap deleted the features/unified-p2p-message-metrics branch March 21, 2024 12:32
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.

2 participants