Skip to content

Conversation

@Exca-DK
Copy link
Contributor

@Exca-DK Exca-DK commented Mar 29, 2023

This PR adds similar to p2p/metrics metered connection for discovery module. The aim is to have more detailed information about network usage which currently isn't tracked for discV4 and discV5.

@Exca-DK Exca-DK requested review from fjl and zsfelfoldi as code owners March 29, 2023 17:13

func newMeteredConn(conn UDPConn) UDPConn {
// Short circuit if metrics are disabled
if !metrics.Enabled {
Copy link
Member

Choose a reason for hiding this comment

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

I am not fully sure that we should use metrics.Enabled or metrics.EnabledExpensive.

The former one will be enabled once the metric system is turned on. The latter one is more for debug purpose which might impact runtime performance.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's OK to use metrics.Enabled for discovery. The packet rate is not so high.

@fjl fjl changed the title p2p/discover: add metered conn p2p/discover: add traffic metrics Apr 25, 2023
@fjl fjl merged commit f8f9534 into ethereum:master Apr 25, 2023
@fjl fjl added this to the 1.11.7 milestone Apr 25, 2023
shekhirin pushed a commit to shekhirin/go-ethereum that referenced this pull request Jun 6, 2023
devopsbo3 pushed a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
nibty pushed a commit to FairCrypto/go-ethereum that referenced this pull request Apr 10, 2024
jakub-freebit pushed a commit to fblch/go-ethereum that referenced this pull request Jul 3, 2025
jakub-freebit pushed a commit to fblch/go-ethereum that referenced this pull request Sep 3, 2025
jakub-freebit pushed a commit to fblch/go-ethereum that referenced this pull request Sep 4, 2025
jakub-freebit pushed a commit to fblch/go-ethereum that referenced this pull request Sep 16, 2025
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