mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-16 00:41:24 +01:00
lib/storage: properly apply time range when matching an empty filter
It must match all the time series on the given time range. Previously it was matched to all the time series without the restriction on the given time range.
This commit is contained in:
parent
dea1cdd817
commit
4e59cf4380
@ -2318,15 +2318,11 @@ func (is *indexSearch) searchMetricIDs(tfss []*TagFilters, tr TimeRange, maxMetr
|
|||||||
metricIDs := &uint64set.Set{}
|
metricIDs := &uint64set.Set{}
|
||||||
for _, tfs := range tfss {
|
for _, tfs := range tfss {
|
||||||
if len(tfs.tfs) == 0 {
|
if len(tfs.tfs) == 0 {
|
||||||
// Return all the metric ids
|
// An empty filters must be equivalent to `{__name__!=""}`
|
||||||
if err := is.updateMetricIDsAll(metricIDs, maxMetrics+1); err != nil {
|
tfs = NewTagFilters(tfs.accountID, tfs.projectID)
|
||||||
return nil, err
|
if err := tfs.Add(nil, nil, true, false); err != nil {
|
||||||
|
logger.Panicf(`BUG: cannot add {__name__!=""} filter: %s`, err)
|
||||||
}
|
}
|
||||||
if metricIDs.Len() > maxMetrics {
|
|
||||||
return nil, fmt.Errorf("the number of unique timeseries exceeds %d; either narrow down the search or increase -search.maxUniqueTimeseries", maxMetrics)
|
|
||||||
}
|
|
||||||
// Stop the iteration, since we cannot find more metric ids with the remaining tfss.
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
if err := is.updateMetricIDsForTagFilters(metricIDs, tfs, tr, maxMetrics+1); err != nil {
|
if err := is.updateMetricIDsForTagFilters(metricIDs, tfs, tr, maxMetrics+1); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user