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 6ca4b94511
commit 5ae47e8940

View file

@ -555,7 +555,7 @@ func QueryHandler(at *auth.Token, 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