reduce unnecessary vmstorage query (#3031)

* reduce unnecessary vmstorage query

* reduce unnecessary vmstorage query

* rollback limit logic /api/v1/label/*
This commit is contained in:
匠心零度 2022-08-30 17:34:23 +08:00 committed by Aliaksandr Valialkin
parent 5d4b1bc742
commit 6d81584d2a
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -616,7 +616,12 @@ func SeriesHandler(qt *querytracer.Tracer, startTime time.Time, w http.ResponseW
if err != nil {
return err
}
sq := storage.NewSearchQuery(cp.start, cp.end, cp.filterss, *maxSeriesLimit)
minLimit := *maxSeriesLimit
if limit > 0 && limit < *maxSeriesLimit {
minLimit = limit
}
sq := storage.NewSearchQuery(cp.start, cp.end, cp.filterss, minLimit)
metricNames, err := netstorage.SearchMetricNames(qt, sq, cp.deadline)
if err != nil {
return fmt.Errorf("cannot fetch time series for %q: %w", sq, err)