mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
p2p: add catchall dialOtherError meter
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
fd020d92f0
commit
7e1e26c9b0
1 changed files with 10 additions and 0 deletions
|
|
@ -59,10 +59,16 @@ var (
|
||||||
dialUnexpectedIdentity = metrics.NewRegisteredMeter("p2p/dials/error/id/unexpected", nil)
|
dialUnexpectedIdentity = metrics.NewRegisteredMeter("p2p/dials/error/id/unexpected", nil)
|
||||||
dialEncHandshakeError = metrics.NewRegisteredMeter("p2p/dials/error/rlpx/enc", nil)
|
dialEncHandshakeError = metrics.NewRegisteredMeter("p2p/dials/error/rlpx/enc", nil)
|
||||||
dialProtoHandshakeError = metrics.NewRegisteredMeter("p2p/dials/error/rlpx/proto", nil)
|
dialProtoHandshakeError = metrics.NewRegisteredMeter("p2p/dials/error/rlpx/proto", nil)
|
||||||
|
|
||||||
|
// capure the rest of errors that are not handled by the above meters
|
||||||
|
dialOtherError = metrics.NewRegisteredMeter("p2p/dials/error/other", nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
// markDialError matches errors that occur while setting up a dial connection
|
// markDialError matches errors that occur while setting up a dial connection
|
||||||
// to the corresponding meter.
|
// to the corresponding meter.
|
||||||
|
// markDialError will bump exactly one meter per call. We don't maintain meters
|
||||||
|
// for evert possible error. If there are multiple levels of wrapped errors, we
|
||||||
|
// capture the innermost for which we have a meter.
|
||||||
func markDialError(err error) {
|
func markDialError(err error) {
|
||||||
if !metrics.Enabled() {
|
if !metrics.Enabled() {
|
||||||
return
|
return
|
||||||
|
|
@ -84,6 +90,10 @@ func markDialError(err error) {
|
||||||
dialEncHandshakeError.Mark(1)
|
dialEncHandshakeError.Mark(1)
|
||||||
case errors.As(err, &phe):
|
case errors.As(err, &phe):
|
||||||
dialProtoHandshakeError.Mark(1)
|
dialProtoHandshakeError.Mark(1)
|
||||||
|
default:
|
||||||
|
// catch all for any other error, not supposed to happen, only here for cross-checking
|
||||||
|
// that all errors are captured by the above meters
|
||||||
|
dialOtherError.Mark(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue