diff --git a/app/vmselect/promql/exec_test.go b/app/vmselect/promql/exec_test.go index 8f1bcc715..a29dde170 100644 --- a/app/vmselect/promql/exec_test.go +++ b/app/vmselect/promql/exec_test.go @@ -1954,9 +1954,9 @@ func TestExecSuccess(t *testing.T) { resultExpected := []netstorage.Result{r1, r2} f(q, resultExpected) }) - t.Run(`sign(time()-1400)`, func(t *testing.T) { + t.Run(`sgn(time()-1400)`, func(t *testing.T) { t.Parallel() - q := `sign(time()-1400)` + q := `sgn(time()-1400)` r := netstorage.Result{ MetricName: metricNameExpected, Values: []float64{-1, -1, 0, 1, 1, 1}, @@ -6871,7 +6871,7 @@ func TestExecError(t *testing.T) { f(`label_mismatch()`) f(`round()`) f(`round(1,2,3)`) - f(`sign()`) + f(`sgn()`) f(`scalar()`) f(`sort(1,2)`) f(`sort_desc()`) diff --git a/app/vmselect/promql/rollup.go b/app/vmselect/promql/rollup.go index b1f418ce0..6728c0bf1 100644 --- a/app/vmselect/promql/rollup.go +++ b/app/vmselect/promql/rollup.go @@ -43,6 +43,7 @@ var rollupFuncs = map[string]newRollupFunc{ "stdvar_over_time": newRollupFuncOneArg(rollupStdvar), "absent_over_time": newRollupFuncOneArg(rollupAbsent), "present_over_time": newRollupFuncOneArg(rollupPresent), + "last_over_time": newRollupFuncOneArg(rollupLast), // Additional rollup funcs. "default_rollup": newRollupFuncOneArg(rollupDefault), // default rollup func @@ -50,7 +51,6 @@ var rollupFuncs = map[string]newRollupFunc{ "sum2_over_time": newRollupFuncOneArg(rollupSum2), "geomean_over_time": newRollupFuncOneArg(rollupGeomean), "first_over_time": newRollupFuncOneArg(rollupFirst), - "last_over_time": newRollupFuncOneArg(rollupLast), "distinct_over_time": newRollupFuncOneArg(rollupDistinct), "increases_over_time": newRollupFuncOneArg(rollupIncreases), "decreases_over_time": newRollupFuncOneArg(rollupDecreases), diff --git a/app/vmselect/promql/transform.go b/app/vmselect/promql/transform.go index 9a0840673..52b4898ed 100644 --- a/app/vmselect/promql/transform.go +++ b/app/vmselect/promql/transform.go @@ -63,7 +63,7 @@ var transformFuncs = map[string]transformFunc{ "minute": newTransformFuncDateTime(transformMinute), "month": newTransformFuncDateTime(transformMonth), "round": transformRound, - "sign": transformSign, + "sgn": transformSign, "scalar": transformScalar, "sort": newTransformFuncSort(false), "sort_desc": newTransformFuncSort(true), diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 576aef1fe..1d16570de 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -11,6 +11,8 @@ sort: 15 * FEATURE: vmalert: add `-disableAlertgroupLabel` command-line flag for disabling the label with alert group name. This may be needed for proper deduplication in Alertmanager. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1532). * FEATURE: update Go builder from v1.16.7 to v1.17.0. This improves data ingestion and query performance by up to 5% according to benchmarks. See [the release post for Go1.17](https://go.dev/blog/go1.17). +* BUGFIX: rename `sign` function to `sgn` in order to be consistent with PromQL. See [this pull request from Prometheus](https://github.com/prometheus/prometheus/pull/8457). + ## [v1.64.1](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.64.1) diff --git a/go.mod b/go.mod index 3bb440578..f2777f429 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( // like https://github.com/valyala/fasthttp/commit/996610f021ff45fdc98c2ce7884d5fa4e7f9199b github.com/VictoriaMetrics/fasthttp v1.0.16 github.com/VictoriaMetrics/metrics v1.17.3 - github.com/VictoriaMetrics/metricsql v0.18.0 + github.com/VictoriaMetrics/metricsql v0.20.0 github.com/VividCortex/ewma v1.2.0 // indirect github.com/aws/aws-sdk-go v1.40.27 github.com/cespare/xxhash/v2 v2.1.1 diff --git a/go.sum b/go.sum index 74aea0a8d..871781b12 100644 --- a/go.sum +++ b/go.sum @@ -108,8 +108,8 @@ github.com/VictoriaMetrics/fasthttp v1.0.16/go.mod h1:s9o5H4T58Kt4CTrdyJp4RorBKC github.com/VictoriaMetrics/metrics v1.12.2/go.mod h1:Z1tSfPfngDn12bTfZSCqArT3OPY3u88J12hSoOhuiRE= github.com/VictoriaMetrics/metrics v1.17.3 h1:QPUakR6JRy8BhL2C2kOgYKLuoPDwtJQ+7iKIZSjt1A4= github.com/VictoriaMetrics/metrics v1.17.3/go.mod h1:Z1tSfPfngDn12bTfZSCqArT3OPY3u88J12hSoOhuiRE= -github.com/VictoriaMetrics/metricsql v0.18.0 h1:BLNCjJPK305rfD4fjpWu7GV9snFj+zlhY8ispLB6rDs= -github.com/VictoriaMetrics/metricsql v0.18.0/go.mod h1:ylO7YITho/Iw6P71oEaGyHbO94bGoGtzWfLGqFhMIg8= +github.com/VictoriaMetrics/metricsql v0.20.0 h1:1rL/naP4+PXdY3Hg5Oj8+Ql+NZCIHzl/OjTmOdg3+mM= +github.com/VictoriaMetrics/metricsql v0.20.0/go.mod h1:ylO7YITho/Iw6P71oEaGyHbO94bGoGtzWfLGqFhMIg8= github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA= github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow= github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4= diff --git a/vendor/github.com/VictoriaMetrics/metricsql/rollup.go b/vendor/github.com/VictoriaMetrics/metricsql/rollup.go index 4db4770f4..a7d17216e 100644 --- a/vendor/github.com/VictoriaMetrics/metricsql/rollup.go +++ b/vendor/github.com/VictoriaMetrics/metricsql/rollup.go @@ -28,6 +28,7 @@ var rollupFuncs = map[string]bool{ "stdvar_over_time": true, "absent_over_time": true, "present_over_time": true, + "last_over_time": true, // Additional rollup funcs. "default_rollup": true, @@ -35,7 +36,6 @@ var rollupFuncs = map[string]bool{ "sum2_over_time": true, "geomean_over_time": true, "first_over_time": true, - "last_over_time": true, "distinct_over_time": true, "increases_over_time": true, "decreases_over_time": true, diff --git a/vendor/github.com/VictoriaMetrics/metricsql/transform.go b/vendor/github.com/VictoriaMetrics/metricsql/transform.go index 81f0afb34..801a00feb 100644 --- a/vendor/github.com/VictoriaMetrics/metricsql/transform.go +++ b/vendor/github.com/VictoriaMetrics/metricsql/transform.go @@ -29,7 +29,7 @@ var transformFuncs = map[string]bool{ "month": true, "round": true, "scalar": true, - "sign": true, + "sgn": true, "sort": true, "sort_desc": true, "sqrt": true, diff --git a/vendor/modules.txt b/vendor/modules.txt index d7c24feb0..499dbc878 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -21,7 +21,7 @@ github.com/VictoriaMetrics/fasthttp/stackless # github.com/VictoriaMetrics/metrics v1.17.3 ## explicit github.com/VictoriaMetrics/metrics -# github.com/VictoriaMetrics/metricsql v0.18.0 +# github.com/VictoriaMetrics/metricsql v0.20.0 ## explicit github.com/VictoriaMetrics/metricsql github.com/VictoriaMetrics/metricsql/binaryop