app/vmselect/promql: do not ajdust offset value provided in the query

Previously it could be modified in order to improve response cache hit ratio.
This is unneeded, since cache hit ratio should remain good because the query time range
should be already aligned to multiple of `step` values.

See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/976
This commit is contained in:
Aliaksandr Valialkin 2020-12-27 14:09:22 +02:00
parent 5c8e4cf03e
commit 47872ada7e
2 changed files with 5 additions and 6 deletions

View file

@ -455,12 +455,10 @@ func evalRollupFunc(ec *EvalConfig, name string, rf rollupFunc, expr metricsql.E
ecNew = newEvalConfig(ecNew) ecNew = newEvalConfig(ecNew)
ecNew.Start -= offset ecNew.Start -= offset
ecNew.End -= offset ecNew.End -= offset
if ecNew.MayCache { // There is no need in calling AdjustStartEnd() on ecNew if ecNew.MayCache is set to true,
start, end := AdjustStartEnd(ecNew.Start, ecNew.End, ecNew.Step) // since the time range alignment has been already performed by the caller,
offset += ecNew.Start - start // so cache hit rate should be quite good.
ecNew.Start = start // See also https://github.com/VictoriaMetrics/VictoriaMetrics/issues/976
ecNew.End = end
}
} }
if name == "rollup_candlestick" { if name == "rollup_candlestick" {
// Automatically apply `offset -step` to `rollup_candlestick` function // Automatically apply `offset -step` to `rollup_candlestick` function

View file

@ -9,6 +9,7 @@
* BUGFIX: vmalert: properly escape multiline queries when passing them to Grafana. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/890 * BUGFIX: vmalert: properly escape multiline queries when passing them to Grafana. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/890
* BUGFIX: vmagent: set missing `__meta_kubernetes_service_*` labels in `kubernetes_sd_config` for `endpoints` and `endpointslices` roles. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/982 * BUGFIX: vmagent: set missing `__meta_kubernetes_service_*` labels in `kubernetes_sd_config` for `endpoints` and `endpointslices` roles. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/982
* BUGFIX: do not adjust `offset` value provided in MetricsQL query. Previously it could be modified in order to improve response cache hit ratio. This is unneeded, since cache hit ratio should remain good because the query time range should be already aligned to multiple of `step` values. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/976
# [v1.50.2](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.50.2) # [v1.50.2](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.50.2)