Skip to content

p2p/discover: add traffic metrics#27008

Merged
fjl merged 3 commits intoethereum:masterfrom
Exca-DK:disc-metrics
Apr 25, 2023
Merged

p2p/discover: add traffic metrics#27008
fjl merged 3 commits intoethereum:masterfrom
Exca-DK:disc-metrics

Conversation

@Exca-DK
Copy link
Copy Markdown
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
Comment thread p2p/discover/metrics.go
Comment thread p2p/discover/metrics.go

func newMeteredConn(conn UDPConn) UDPConn {
// Short circuit if metrics are disabled
if !metrics.Enabled {
Copy link
Copy Markdown
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
Copy Markdown
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
Co-authored-by: Exca-DK <dev@DESKTOP-RI45P4J.localdomain>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
devopsbo3 pushed a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
Co-authored-by: Exca-DK <dev@DESKTOP-RI45P4J.localdomain>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
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
Co-authored-by: Exca-DK <dev@DESKTOP-RI45P4J.localdomain>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
jakub-freebit pushed a commit to fblch/go-ethereum that referenced this pull request Jul 3, 2025
Co-authored-by: Exca-DK <dev@DESKTOP-RI45P4J.localdomain>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
jakub-freebit pushed a commit to fblch/go-ethereum that referenced this pull request Sep 3, 2025
Co-authored-by: Exca-DK <dev@DESKTOP-RI45P4J.localdomain>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
jakub-freebit pushed a commit to fblch/go-ethereum that referenced this pull request Sep 4, 2025
Co-authored-by: Exca-DK <dev@DESKTOP-RI45P4J.localdomain>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
jakub-freebit pushed a commit to fblch/go-ethereum that referenced this pull request Sep 16, 2025
Co-authored-by: Exca-DK <dev@DESKTOP-RI45P4J.localdomain>
Co-authored-by: rjl493456442 <garyrong0905@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.

4 participants