app/vmselect/promql: apply SLO-like optimization to all the count_*_over_time() functions

This is a follow-up for 41a0fdaf39
This commit is contained in:
Aliaksandr Valialkin 2023-11-01 09:57:55 +01:00
parent b96d55e1e4
commit c5e3b11762
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1
2 changed files with 11 additions and 2 deletions

View File

@ -1171,7 +1171,15 @@ func evalInstantRollup(qt *querytracer.Tracer, ec *EvalConfig, funcName string,
},
}
return evalExpr(qt, ec, be)
case "count_over_time", "sum_over_time", "increase":
case
"count_eq_over_time",
"count_gt_over_time",
"count_le_over_time",
"count_ne_over_time",
"count_over_time",
"increase",
"increase_pure",
"sum_over_time":
if iafc != nil && strings.ToLower(iafc.ae.Name) != "sum" {
qt.Printf("do not apply instant rollup optimization for non-sum incremental aggregate %s()", iafc.ae.Name)
return evalAt(qt, timestamp, window)

View File

@ -583,7 +583,8 @@ func mergeTimeseries(qt *querytracer.Tracer, a, b []*timeseries, bStart int64, e
}
tmp.Values = append(tmp.Values, tsB.Values...)
if len(tmp.Values) != len(tmp.Timestamps) {
logger.Panicf("BUG: unexpected values after merging new values; got %d; want %d", len(tmp.Values), len(tmp.Timestamps))
logger.Panicf("BUG: unexpected values after merging new values; got %d; want %d; len(a.Values)=%d; len(b.Values)=%d",
len(tmp.Values), len(tmp.Timestamps), len(tsA.Values), len(tsB.Values))
}
rvs = append(rvs, &tmp)
}