mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/storage: mention time range used in the query that led to error message
This should improve detecting slow queries with too big time ranges
This commit is contained in:
parent
582c74cd93
commit
8d9eb5f808
1 changed files with 6 additions and 1 deletions
|
@ -65,6 +65,9 @@ type Search struct {
|
|||
|
||||
ts tableSearch
|
||||
|
||||
// tr contains time range used in the serach.
|
||||
tr TimeRange
|
||||
|
||||
// tfss contains tag filters used in the search.
|
||||
tfss []*TagFilters
|
||||
|
||||
|
@ -84,6 +87,7 @@ func (s *Search) reset() {
|
|||
|
||||
s.storage = nil
|
||||
s.ts.reset()
|
||||
s.tr = TimeRange{}
|
||||
s.tfss = nil
|
||||
s.deadline = 0
|
||||
s.err = nil
|
||||
|
@ -102,6 +106,7 @@ func (s *Search) Init(storage *Storage, tfss []*TagFilters, tr TimeRange, maxMet
|
|||
}
|
||||
|
||||
s.reset()
|
||||
s.tr = tr
|
||||
s.tfss = tfss
|
||||
s.deadline = deadline
|
||||
s.needClosing = true
|
||||
|
@ -138,7 +143,7 @@ func (s *Search) Error() error {
|
|||
if s.err == io.EOF || s.err == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("error when searching for tagFilters=%s: %w", s.tfss, s.err)
|
||||
return fmt.Errorf("error when searching for tagFilters=%s on the time range %s: %w", s.tfss, s.tr.String(), s.err)
|
||||
}
|
||||
|
||||
// NextMetricBlock proceeds to the next MetricBlockRef.
|
||||
|
|
Loading…
Reference in a new issue