-
Notifications
You must be signed in to change notification settings - Fork 21.9k
p2p, p2p/discover: add dial metrics #27621
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
76b18e0
p2p/discover,cmd/devp2p: add bucket metrics to discovery
lightclient 96dbd06
p2p: add metrics to track successful dials
lightclient a8a282f
p2p: add disconnect reasons to metrics
lightclient 3d0455e
p2p: better metrics organization
lightclient 1001cc1
p2p: more dial fail reasons
lightclient 3da70b9
p2p/discovery: fix bucket guage
lightclient 729fa45
p2p/discover: change guage to counter
lightclient 6c9ac36
p2p: add error prefix to metrics
lightclient 006d53c
p2p: remove no secp256k1 metric
lightclient 111fa80
eth: add metrics to eth handshake
lightclient 6d1e0f9
p2p: don't count inbound errors toward dial errors
lightclient 88353a8
eth: export snap registration meter instead of name
lightclient 18c0cc7
p2p/discover: simplify table meterics tracking
lightclient 7b9a633
eth: don't export get method on bidirectionalMeters type
lightclient File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| // Copyright 2023 The go-ethereum Authors | ||
| // This file is part of the go-ethereum library. | ||
| // | ||
| // The go-ethereum library is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU Lesser General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
| // | ||
| // The go-ethereum library is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU Lesser General Public License for more details. | ||
| // | ||
| // You should have received a copy of the GNU Lesser General Public License | ||
| // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| package eth | ||
|
|
||
| import "github.com/ethereum/go-ethereum/metrics" | ||
|
|
||
| // meters stores ingress and egress handshake meters. | ||
| var meters bidirectionalMeters | ||
|
|
||
| // bidirectionalMeters stores ingress and egress handshake meters. | ||
| type bidirectionalMeters struct { | ||
| ingress *hsMeters | ||
| egress *hsMeters | ||
| } | ||
|
|
||
| // get returns the corresponding meter depending if ingress or egress is | ||
| // desired. | ||
| func (h *bidirectionalMeters) get(ingress bool) *hsMeters { | ||
| if ingress { | ||
| return h.ingress | ||
| } | ||
| return h.egress | ||
| } | ||
|
|
||
| // hsMeters is a collection of meters which track metrics related to the | ||
| // eth subprotocol handshake. | ||
| type hsMeters struct { | ||
| // peerError measures the number of errors related to incorrect peer | ||
| // behaviour, such as invalid message code, size, encoding, etc. | ||
| peerError metrics.Meter | ||
|
|
||
| // timeoutError measures the number of timeouts. | ||
| timeoutError metrics.Meter | ||
|
|
||
| // networkIDMismatch measures the number of network id mismatch errors. | ||
| networkIDMismatch metrics.Meter | ||
|
|
||
| // protocolVersionMismatch measures the number of differing protocol | ||
| // versions. | ||
| protocolVersionMismatch metrics.Meter | ||
|
|
||
| // genesisMismatch measures the number of differing genesises. | ||
| genesisMismatch metrics.Meter | ||
|
|
||
| // forkidRejected measures the number of differing forkids. | ||
| forkidRejected metrics.Meter | ||
| } | ||
|
|
||
| // newHandshakeMeters registers and returns handshake meters for the given | ||
| // base. | ||
| func newHandshakeMeters(base string) *hsMeters { | ||
| return &hsMeters{ | ||
| peerError: metrics.NewRegisteredMeter(base+"error/peer", nil), | ||
| timeoutError: metrics.NewRegisteredMeter(base+"error/timeout", nil), | ||
| networkIDMismatch: metrics.NewRegisteredMeter(base+"error/network", nil), | ||
| protocolVersionMismatch: metrics.NewRegisteredMeter(base+"error/version", nil), | ||
| genesisMismatch: metrics.NewRegisteredMeter(base+"error/genesis", nil), | ||
| forkidRejected: metrics.NewRegisteredMeter(base+"error/forkid", nil), | ||
| } | ||
| } | ||
|
|
||
| func init() { | ||
| meters = bidirectionalMeters{ | ||
| ingress: newHandshakeMeters("eth/protocols/eth/ingress/handshake/"), | ||
| egress: newHandshakeMeters("eth/protocols/eth/egress/handshake/"), | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // Copyright 2023 The go-ethereum Authors | ||
| // This file is part of the go-ethereum library. | ||
| // | ||
| // The go-ethereum library is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU Lesser General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
| // | ||
| // The go-ethereum library is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU Lesser General Public License for more details. | ||
| // | ||
| // You should have received a copy of the GNU Lesser General Public License | ||
| // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| package snap | ||
|
|
||
| import ( | ||
| metrics "github.com/ethereum/go-ethereum/metrics" | ||
| ) | ||
|
|
||
| var ( | ||
| ingressRegistrationErrorName = "eth/protocols/snap/ingress/registration/error" | ||
| egressRegistrationErrorName = "eth/protocols/snap/egress/registration/error" | ||
|
|
||
| IngressRegistrationErrorMeter = metrics.NewRegisteredMeter(ingressRegistrationErrorName, nil) | ||
| EgressRegistrationErrorMeter = metrics.NewRegisteredMeter(egressRegistrationErrorName, nil) | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.