app/vmselect/prometheus: properly adjust too big time time on /api/v1/query

Too big `time` must be adjusted to `now()-queryOffset`.
This commit is contained in:
Aliaksandr Valialkin 2019-11-19 00:41:13 +02:00
parent b6f22a62cb
commit 0094bc4fc9

View File

@ -481,7 +481,7 @@ func QueryHandler(w http.ResponseWriter, r *http.Request) error {
return fmt.Errorf(`too long query; got %d bytes; mustn't exceed %d bytes`, len(query), *maxQueryLen)
}
if ct-start < queryOffset {
start -= queryOffset
start = ct - queryOffset
}
if childQuery, windowStr, offsetStr := promql.IsMetricSelectorWithRollup(query); childQuery != "" {
var window int64