influxdata / influxdata/kapacitor
Zero values end up being sent as an integer even though there is an explicit cast to float
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
In this tick script the field of interest is `iops_in_progress`. There are 2 issues with this.
1. zero values end up being sent as an integer even though there is an explicit cast to float. (this was easy to verify by looking at the sent packets with tcpdump)
2. when a mix of int and float values are sent to influx, if one shard sees an int value first and the other sees a float value first we end up with a split type problem for this field.
In the `7d` retention period `iops_in_progress` is an int type and in the `365d` retention period it *should* be a float.
```
// component: metrics
// purpose: rollup
dbrp "infra-metrics"."7d"
var data = stream
|from()
.database('infra-metrics')
.measurement('diskio')
.where(lambda: TRUE)
.groupBy(*)
|window()
.period(5m)
.every(5m)
.align()
var io_time = data
|last('io_time')
.as('io_time')
var iops_in_progress = data
|mean('iops_in_progress')
.as('iops_in_progress')
|eval(lambda: float("iops_in_progress"))
.as('iops_in_progress')
var read_bytes = data
|last('read_bytes')
.as('read_bytes')
var read_time = data
|last('read_time')
.as('read_time')
var reads = data
|last('reads')
.as('reads')
var weighted_io_time = data
|last('weighted_io_time')
.as('weighted_io_time')
var write_bytes = data
|last('write_bytes')
.as('write_bytes')
var write_time = data
|last('write_time')
.as('write_time')
var writes = data
|last('writes')
.as('writes')
io_time
|union(iops_in_progress, read_bytes, read_time, reads, weighted_io_time, write_bytes, write_time, writes)
|influxDBOut()
.database('infra-metrics')
.retentionPolicy('365d')
```
Contributor guide
Assessment
This issue has not been assessed yet.