diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d5a8da1d0..f21551350 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -41,6 +41,7 @@ See also [LTS releases](https://docs.victoriametrics.com/lts-releases/). * BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): fix bug that prevents the first query trace from expanding on click event. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6186). The issue was introduced in [v1.100.0](https://docs.victoriametrics.com/changelog/#v11000) release. * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent/): prevent potential panic during [stream aggregation](https://docs.victoriametrics.com/stream-aggregation.html) if more than one `--remoteWrite.streamAggr.dedupInterval` is configured. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/6205). +* BUGFIX: [stream aggregation](https://docs.victoriametrics.com/stream-aggregation/): set correct suffix `_prometheus` for aggregation outputs [increase_prometheus](https://docs.victoriametrics.com/stream-aggregation/#increase_prometheus) and [total_prometheus](https://docs.victoriametrics.com/stream-aggregation/#total_prometheus). Before, outputs `total` and `total_prometheus` or `increase` and `increase_prometheus` had the same suffix. ## [v1.101.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.101.0) diff --git a/lib/streamaggr/streamaggr_test.go b/lib/streamaggr/streamaggr_test.go index c4731673b..ae234bb76 100644 --- a/lib/streamaggr/streamaggr_test.go +++ b/lib/streamaggr/streamaggr_test.go @@ -518,8 +518,8 @@ foo:1m_total 0 `, ` foo 123 bar{baz="qwe"} 4.34 -`, `bar:1m_total{baz="qwe"} 0 -foo:1m_total 0 +`, `bar:1m_total_prometheus{baz="qwe"} 0 +foo:1m_total_prometheus 0 `, "11") // total output for repeated series @@ -554,10 +554,10 @@ foo{baz="qwe"} -5 bar{baz="qwer"} 343 bar{baz="qwer"} 344 foo{baz="qwe"} 10 -`, `bar:1m_total{baz="qwe"} 5.02 -bar:1m_total{baz="qwer"} 1 -foo:1m_total 0 -foo:1m_total{baz="qwe"} 15 +`, `bar:1m_total_prometheus{baz="qwe"} 5.02 +bar:1m_total_prometheus{baz="qwer"} 1 +foo:1m_total_prometheus 0 +foo:1m_total_prometheus{baz="qwe"} 15 `, "11111111") // total output for repeated series with group by __name__ @@ -592,8 +592,8 @@ foo{baz="qwe"} -5 bar{baz="qwer"} 343 bar{baz="qwer"} 344 foo{baz="qwe"} 10 -`, `bar:1m_total 6.02 -foo:1m_total 15 +`, `bar:1m_total_prometheus 6.02 +foo:1m_total_prometheus 15 `, "11111111") // increase output for non-repeated series @@ -614,8 +614,8 @@ foo:1m_increase 0 `, ` foo 123 bar{baz="qwe"} 4.34 -`, `bar:1m_increase{baz="qwe"} 0 -foo:1m_increase 0 +`, `bar:1m_increase_prometheus{baz="qwe"} 0 +foo:1m_increase_prometheus 0 `, "11") // increase output for repeated series @@ -650,10 +650,10 @@ foo{baz="qwe"} -5 bar{baz="qwer"} 343 bar{baz="qwer"} 344 foo{baz="qwe"} 10 -`, `bar:1m_increase{baz="qwe"} 5.02 -bar:1m_increase{baz="qwer"} 1 -foo:1m_increase 0 -foo:1m_increase{baz="qwe"} 15 +`, `bar:1m_increase_prometheus{baz="qwe"} 5.02 +bar:1m_increase_prometheus{baz="qwer"} 1 +foo:1m_increase_prometheus 0 +foo:1m_increase_prometheus{baz="qwe"} 15 `, "11111111") // multiple aggregate configs diff --git a/lib/streamaggr/total.go b/lib/streamaggr/total.go index e0b28d437..a0576245e 100644 --- a/lib/streamaggr/total.go +++ b/lib/streamaggr/total.go @@ -53,6 +53,9 @@ func newTotalAggrState(stalenessInterval time.Duration, resetTotalOnFlush, keepF if resetTotalOnFlush { suffix = "increase" } + if !keepFirstSample { + suffix += "_prometheus" + } return &totalAggrState{ suffix: suffix, resetTotalOnFlush: resetTotalOnFlush,