influxdata / influxdata/kapacitor
Percentile cuts off fields after execution, no option to preserve
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
In my tick script I want to compare the value against 90th percentile of the series of the values, however this results in error that field is missing after percentile evaluation and there's no way to `keep` it, similar to `eval` node. The field value is numerical, so converting to a tag is not an option.
```
stream
...
|eval(lambda: abs("cpu.usage_user" - "mean_4h.mean_usage_user"))
.as('delta')
|percentile('delta', 90.0)
.as('delta_90th_percentile')
|eval(lambda: "delta" > "delta_90th_percentile")
...
```
```
ts=2018-06-03T14:32:59.815-07:00 lvl=error msg="error evaluating expression" service=kapacitor task_master=main task=my_anomaly node=eval15 err="left reference value \"delta\" is missing value"
```
```
kapacitor stats general
ClusterID: 14aecaee-b88b-420b-9eaa-4e572a0035f6
ServerID: 30a9d71d-e00a-4833-b3bb-e6dd88016b93
Host: localhost
Tasks: 1
Enabled Tasks: 1
Subscriptions: 6
Platform: OSS
Version: v1.5.0
```
```
influx -version
InfluxDB shell version: v1.5.3
```
Contributor guide
Research direction
Start with the tick script and the percentile node behavior shown in the issue, then trace how percentile evaluation affects the fields available to the following eval node. Done means the percentile result can be used while preserving the original numerical delta field, with coverage for the demonstrated comparison case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- stream-processing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100