diff --git a/lib/storage/search.go b/lib/storage/search.go index 4cdbe80fb..3f855f97a 100644 --- a/lib/storage/search.go +++ b/lib/storage/search.go @@ -130,6 +130,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 @@ -149,6 +152,7 @@ func (s *Search) reset() { s.storage = nil s.ts.reset() + s.tr = TimeRange{} s.tfss = nil s.deadline = 0 s.err = nil @@ -167,6 +171,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 @@ -203,7 +208,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.