What is the meaning of applying avg() over a range vector such as:
avg(meric_name[1d])
As per the documentation here, it only operated on an instant vector. The metric_name[1d] returns a range vector. This query still runs over the range vector and returns a result without any complains about being wrong.
The
avg(m[d])query doesn't work in Prometheus as Brian already noted, because this is valid MetricsQL query and is invalid PromQL query.VictoriaMetrics automatically converts the
avg(m[d])query toavg(last_over_time(m[d])). Thelast_over_time(m[d])returns the last raw values formoverdduration for every returned data point. Then theavg(...)calculates average for resulting time series.The
last_over_time()function could be useful for covering gaps in time series data if these gaps exceedstepvalue passed to /api/v1/query_range.See more details about
last_over_time()function at MetricsQL docs.