mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-21 15:45:01 +00:00
lib/storage: mention tag filters used in the query that led to error message
This should improve detecting invalid or heavy queries that lead to errors.
This commit is contained in:
parent
f3d33e23c9
commit
582c74cd93
2 changed files with 8 additions and 3 deletions
|
@ -65,6 +65,9 @@ type Search struct {
|
||||||
|
|
||||||
ts tableSearch
|
ts tableSearch
|
||||||
|
|
||||||
|
// tfss contains tag filters used in the search.
|
||||||
|
tfss []*TagFilters
|
||||||
|
|
||||||
// deadline in unix timestamp seconds for the current search.
|
// deadline in unix timestamp seconds for the current search.
|
||||||
deadline uint64
|
deadline uint64
|
||||||
|
|
||||||
|
@ -81,6 +84,7 @@ func (s *Search) reset() {
|
||||||
|
|
||||||
s.storage = nil
|
s.storage = nil
|
||||||
s.ts.reset()
|
s.ts.reset()
|
||||||
|
s.tfss = nil
|
||||||
s.deadline = 0
|
s.deadline = 0
|
||||||
s.err = nil
|
s.err = nil
|
||||||
s.needClosing = false
|
s.needClosing = false
|
||||||
|
@ -98,6 +102,7 @@ func (s *Search) Init(storage *Storage, tfss []*TagFilters, tr TimeRange, maxMet
|
||||||
}
|
}
|
||||||
|
|
||||||
s.reset()
|
s.reset()
|
||||||
|
s.tfss = tfss
|
||||||
s.deadline = deadline
|
s.deadline = deadline
|
||||||
s.needClosing = true
|
s.needClosing = true
|
||||||
|
|
||||||
|
@ -130,10 +135,10 @@ func (s *Search) MustClose() {
|
||||||
|
|
||||||
// Error returns the last error from s.
|
// Error returns the last error from s.
|
||||||
func (s *Search) Error() error {
|
func (s *Search) Error() error {
|
||||||
if s.err == io.EOF {
|
if s.err == io.EOF || s.err == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return s.err
|
return fmt.Errorf("error when searching for tagFilters=%s: %w", s.tfss, s.err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NextMetricBlock proceeds to the next MetricBlockRef.
|
// NextMetricBlock proceeds to the next MetricBlockRef.
|
||||||
|
|
|
@ -821,7 +821,7 @@ func (s *Storage) searchTSIDs(tfss []*TagFilters, tr TimeRange, maxMetrics int,
|
||||||
tsids, err := s.idb().searchTSIDs(tfss, tr, maxMetrics, deadline)
|
tsids, err := s.idb().searchTSIDs(tfss, tr, maxMetrics, deadline)
|
||||||
<-searchTSIDsConcurrencyCh
|
<-searchTSIDsConcurrencyCh
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error when searching tsids for tfss %q: %w", tfss, err)
|
return nil, fmt.Errorf("error when searching tsids: %w", err)
|
||||||
}
|
}
|
||||||
return tsids, nil
|
return tsids, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue