app/vmselect/netstorage: properly detect and log timeout errors when querying vmstorage from vmselect

This change is based on https://github.com/VictoriaMetrics/VictoriaMetrics/pull/2937

Thanks to @isodude for the initial pull request.
This commit is contained in:
Aliaksandr Valialkin 2022-08-08 00:20:37 +03:00
parent a2ecf311b8
commit 2635211bf4
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1

View File

@ -9,6 +9,7 @@ import (
"math/rand"
"net"
"net/http"
"os"
"regexp"
"sort"
"strings"
@ -1728,7 +1729,7 @@ func (sn *storageNode) execOnConn(qt *querytracer.Tracer, funcName string, f fun
// since it may be broken.
_ = bc.Close()
}
if deadline.Exceeded() {
if deadline.Exceeded() || errors.Is(err, os.ErrDeadlineExceeded) {
return fmt.Errorf("cannot execute funcName=%q on vmstorage %q with timeout %s: %w", funcName, remoteAddr, deadline.String(), err)
}
return fmt.Errorf("cannot execute funcName=%q on vmstorage %q: %w", funcName, remoteAddr, err)