mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vmselect: fixes graphite function transformRemoveEmptySeries
Previously it incorrectly applied xFilesFactor, if it's value equal to 0. This commit properly handles this case and returns result according to the graphite documentation: `xFilesFactor follows the same semantics as in Whisper storage schemas. Setting it to 0 (the default) means that only a single value in the series needs to be non-null for it to be considered non-empty, setting it to 1 means that all values in the series must be non-null. A setting of 0.5 means that at least half the values in the series must be non-null.` Signed-off-by: f41gh7 <nik@victoriametrics.com> Co-authored-by: Evgeniy Negriy <einegriy@avito.ru>
This commit is contained in:
parent
3aeb1b96a2
commit
d27dfac5c6
3 changed files with 21 additions and 1 deletions
|
@ -2137,6 +2137,25 @@ func TestExecExprSuccess(t *testing.T) {
|
|||
},
|
||||
})
|
||||
f(`removeEmptySeries(removeBelowValue(time('a'),150),1)`, []*series{})
|
||||
// if xFilesFactor is set, a single value in the series needs to be non-null for it to be
|
||||
// considered non-empty
|
||||
f(`removeEmptySeries(removeBelowValue(time('a'),150),0)`, []*series{
|
||||
{
|
||||
Timestamps: []int64{120000, 180000},
|
||||
Values: []float64{nan, 180},
|
||||
Name: "removeBelowValue(a,150)",
|
||||
Tags: map[string]string{"name": "a"},
|
||||
},
|
||||
})
|
||||
f(`removeEmptySeries(removeBelowValue(time('a'),150),-1)`, []*series{
|
||||
{
|
||||
Timestamps: []int64{120000, 180000},
|
||||
Values: []float64{nan, 180},
|
||||
Name: "removeBelowValue(a,150)",
|
||||
Tags: map[string]string{"name": "a"},
|
||||
},
|
||||
})
|
||||
|
||||
f(`round(time('a',17),-1)`, []*series{
|
||||
{
|
||||
Timestamps: []int64{120000, 137000, 154000, 171000, 188000, 205000},
|
||||
|
|
|
@ -3151,7 +3151,7 @@ func transformRemoveEmptySeries(ec *evalConfig, fe *graphiteql.FuncExpr) (nextSe
|
|||
xff = xFilesFactor
|
||||
}
|
||||
n := aggrCount(s.Values)
|
||||
if n/float64(len(s.Values)) < xff {
|
||||
if n/float64(len(s.Values)) <= xff {
|
||||
return nil, nil
|
||||
}
|
||||
s.expr = fe
|
||||
|
|
|
@ -20,6 +20,7 @@ See also [LTS releases](https://docs.victoriametrics.com/lts-releases/).
|
|||
|
||||
* BUGFIX: [vmctl](https://docs.victoriametrics.com/vmctl/): drop rows that do not belong to the current series during import. The dropped rows should belong to another series whose tags are a superset of the current series. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7301) and [this pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/7330). Thanks to @dpedu for reporting and cooperating with the test.
|
||||
* BUGFIX: [vmsingle](https://docs.victoriametrics.com/single-server-victoriametrics/), `vmselect` in [VictoriaMetrics cluster](https://docs.victoriametrics.com/cluster-victoriametrics/): keep the order of resulting time series when `limit_offset` is applied. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7068).
|
||||
* BUGFIX: [graphite](https://docs.victoriametrics.com/#graphite-render-api-usage): properly handle xFilesFactor=0 for `transformRemoveEmptySeries` function. See [this PR](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/7337) for details.
|
||||
|
||||
## [v1.106.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.106.0)
|
||||
|
||||
|
|
Loading…
Reference in a new issue