mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-21 15:45:01 +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
f92255e803
commit
4ce1368e4b
1 changed files with 6 additions and 1 deletions
|
@ -130,6 +130,9 @@ type Search struct {
|
||||||
|
|
||||||
ts tableSearch
|
ts tableSearch
|
||||||
|
|
||||||
|
// tr contains time range used in the serach.
|
||||||
|
tr TimeRange
|
||||||
|
|
||||||
// tfss contains tag filters used in the search.
|
// tfss contains tag filters used in the search.
|
||||||
tfss []*TagFilters
|
tfss []*TagFilters
|
||||||
|
|
||||||
|
@ -149,6 +152,7 @@ func (s *Search) reset() {
|
||||||
|
|
||||||
s.storage = nil
|
s.storage = nil
|
||||||
s.ts.reset()
|
s.ts.reset()
|
||||||
|
s.tr = TimeRange{}
|
||||||
s.tfss = nil
|
s.tfss = nil
|
||||||
s.deadline = 0
|
s.deadline = 0
|
||||||
s.err = nil
|
s.err = nil
|
||||||
|
@ -167,6 +171,7 @@ func (s *Search) Init(storage *Storage, tfss []*TagFilters, tr TimeRange, maxMet
|
||||||
}
|
}
|
||||||
|
|
||||||
s.reset()
|
s.reset()
|
||||||
|
s.tr = tr
|
||||||
s.tfss = tfss
|
s.tfss = tfss
|
||||||
s.deadline = deadline
|
s.deadline = deadline
|
||||||
s.needClosing = true
|
s.needClosing = true
|
||||||
|
@ -203,7 +208,7 @@ func (s *Search) Error() error {
|
||||||
if s.err == io.EOF || s.err == nil {
|
if s.err == io.EOF || s.err == nil {
|
||||||
return 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.
|
// NextMetricBlock proceeds to the next MetricBlockRef.
|
||||||
|
|
Loading…
Reference in a new issue