mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 20:37:12 +01:00
lib/netutil: do not count timeouts as network errors
This commit is contained in:
parent
575d2f0a91
commit
daba0cdb05
@ -72,9 +72,10 @@ func (sc *statConn) Read(p []byte) (int, error) {
|
||||
sc.cm.readCalls.Inc()
|
||||
sc.cm.readBytes.Add(n)
|
||||
if err != nil && err != io.EOF {
|
||||
sc.cm.readErrors.Inc()
|
||||
if ne, ok := err.(net.Error); ok && ne.Timeout() {
|
||||
sc.cm.readTimeouts.Inc()
|
||||
} else {
|
||||
sc.cm.readErrors.Inc()
|
||||
}
|
||||
}
|
||||
return n, err
|
||||
@ -96,9 +97,10 @@ func (sc *statConn) Write(p []byte) (int, error) {
|
||||
sc.cm.writeCalls.Inc()
|
||||
sc.cm.writtenBytes.Add(n)
|
||||
if err != nil {
|
||||
sc.cm.writeErrors.Inc()
|
||||
if ne, ok := err.(net.Error); ok && ne.Timeout() {
|
||||
sc.cm.writeTimeouts.Inc()
|
||||
} else {
|
||||
sc.cm.writeErrors.Inc()
|
||||
}
|
||||
}
|
||||
return n, err
|
||||
|
Loading…
Reference in New Issue
Block a user