influxdata / influxdata/kapacitor
Alert Data Field Value Integer Type Error
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
I am ingesting line protocol into Kapacitor through the HTTP endpoint and seeing floats in the field_set being interpreted as integers. When the floating point number ends in .0 it is interpreted as an integer in the data portion of the generated alert.
Line protocol ingested:
```
diagnostics,name=truck_100 load_capacity=100.0 1704153700000000000
```
Alert generated:
```
{
"id": "diagnostics:nil",
"message": "diagnostics:nil is INFO",
"details": "...",
"time": "2024-01-02T00:01:40Z",
"duration": 0,
"level": "INFO",
"data": {
"series": [
{
"name": "diagnostics",
"tags": {
"name": "truck_100"
},
"columns": [
"time",
"load_capacity"
],
"values": [
[
"2024-01-02T00:01:40Z",
100
]
]
}
]
},
"previousLevel": "OK",
"recoverable": true
}
```
Here I pass in 100.0 for the load_capacity and the value is reflected as an integer in the data portion of the JSON alert. This only occurs if the floating point ends with a 0.
Contributor guide
Research direction
Reproduce the issue through Kapacitor's HTTP endpoint using the supplied line protocol and inspect the generated JSON alert's data field. Trace how the line-protocol value reaches the alert output, then verify that 100.0 remains a floating-point value rather than becoming 100.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, observability-sre
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100