mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vmstorage: improve error logging when the request times out
This commit is contained in:
parent
455bf50a91
commit
f3d33e23c9
3 changed files with 7 additions and 2 deletions
|
@ -2,6 +2,7 @@ package netstorage
|
|||
|
||||
import (
|
||||
"container/heap"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"runtime"
|
||||
|
@ -618,6 +619,9 @@ func ProcessSearchQuery(sq *storage.SearchQuery, fetchData bool, deadline Deadli
|
|||
}
|
||||
}
|
||||
if err := sr.Error(); err != nil {
|
||||
if errors.Is(err, storage.ErrDeadlineExceeded) {
|
||||
return nil, fmt.Errorf("timeout exceeded during the query: %s", deadline.String())
|
||||
}
|
||||
return nil, fmt.Errorf("search error after reading %d data blocks: %w", blocksRead, err)
|
||||
}
|
||||
|
||||
|
|
|
@ -335,7 +335,7 @@ func (sq *SearchQuery) Unmarshal(src []byte) ([]byte, error) {
|
|||
|
||||
func checkSearchDeadlineAndPace(deadline uint64) error {
|
||||
if fasttime.UnixTimestamp() > deadline {
|
||||
return errDeadlineExceeded
|
||||
return ErrDeadlineExceeded
|
||||
}
|
||||
storagepacelimiter.Search.WaitIfNeeded()
|
||||
return nil
|
||||
|
|
|
@ -887,7 +887,8 @@ func (s *Storage) prefetchMetricNames(tsids []TSID, deadline uint64) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var errDeadlineExceeded = fmt.Errorf("deadline exceeded")
|
||||
// ErrDeadlineExceeded is returned when the request times out.
|
||||
var ErrDeadlineExceeded = fmt.Errorf("deadline exceeded")
|
||||
|
||||
// DeleteMetrics deletes all the metrics matching the given tfss.
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue