Victoriametrics: Functions don't always remove the metric name when they should

Created on 6 Aug 2020  路  7Comments  路  Source: VictoriaMetrics/VictoriaMetrics

Describe the bug
A lot of functions in MetricsQL do not remove the metric name, whereas native PromQL removes the metric name at any time when the series are transformed in a way that the original name is no longer valid.

To Reproduce
Run queries like the following and observe that the metric name does not get removed:

  • avg_over_time(foo[1h]) (or other _over_time() functions)
  • ceil(foo) / floor(foo) / round(foo) / clamp_min(foo) / clamp_max(foo)

...and maybe more.

Expected behavior
The metric name should be removed when using the aforementioned functions.

Version

$ ./victoria-metrics-prod --version
victoria-metrics-20200727-204526-tags-v1.39.1-0-g5b81bdde3
enhancement question

All 7 comments

@juliusv , thanks for filing this issue! It should be addressed with the following commits:

  • e5202a4eaee52b3bf03f59fabdc09a84352857c4
  • ac45082216f7ffaa46d8a1d0c51270a4fe1191ab
  • bb61a4769bf7e3f4b200c3970138f289a6ff8bdc

These commits will be included in the next release of VictoriaMetrics.

Great, thanks for the quick fixes!

All the bugfixes for this issue have been added into v1.39.4. Closing this issue as fixed.

It has been appeared that the original behavior in VictoriaMetrics is more intuitive to users than the behaviour from Prometheus. So it has been decided restoring the original behavior, i.e. to leave metric names after applying functions, which don't change time series meaning. This allows writing the following queries: max_over_time({__name__=~"go_memstats_heap_(inuse|alloc)_bytes"}), which would return max values for both go_memstats_heap_inuse_bytes and go_memstats_heap_alloc_bytes metrics.

Below it the full list of functions, which don't change the meaning of the original time series and don't remove metric names from the result:

  • keep_last_value
  • keep_next_value
  • interpolate
  • running_min
  • running_max
  • running_avg
  • range_min
  • range_max
  • range_avg
  • range_first
  • range_last
  • range_quantile
  • smooth_exponential
  • ceil
  • floor
  • round
  • clamp_min
  • clamp_max
  • max_over_time
  • min_over_time
  • avg_over_time
  • quantile_over_time
  • mode_over_time
  • geomean_over_time
  • holt_winters
  • predict_linear

The original behavior for these functions will be restored in the next release of VictoriaMetrics.

The original behaviour for functions that don't change time series meaning has been restored starting from VictoriaMetrics v1.44.0. Closing the issue as done.

"Below it the full list of functions, which don't change the meaning of the original time series..."
What about sum_over_time and rest *_over_time functions?
Do they change some meaning?
Or was this rollback intended only for "original VictoriaMetrics behavior"?

Those functions (at least the ones that also exist in PromQL) do change the meaning of the underlying metric, so the correct behavior is to remove the metric name.

Was this page helpful?
0 / 5 - 0 ratings