kapacitor icon indicating copy to clipboard operation
kapacitor copied to clipboard

Alert Data Field Value Integer Type Error

Open forestmvey opened this issue 11 months ago • 1 comments

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.

forestmvey avatar Mar 12 '24 14:03 forestmvey

Is there a way to have these floats interpreted correctly?

forestmvey avatar Mar 12 '24 14:03 forestmvey