AIT-Core icon indicating copy to clipboard operation
AIT-Core copied to clipboard

Telemetry with array-type values can't be written to influxdb

Open kmarwah opened this issue 3 years ago • 0 comments

Writing telemetry with FieldList objects to InfluxDB fails. The InfluxDB responds with a "invalid boolean" error when it receives a payload with FieldList objects. The FieldList class needs a decode function similar to the decode function in the dtype.ArrayType class which can be called when generating the data payload in the insert function within the InfluxDBBackend plugin.

Error messages in the console: image

A potential fix in the InfluxDBBackend plugin would look like:

    def insert(self, packet, time=None, **kwargs):
        fields = {}
        pd = packet._defn

        for defn in pd.fields:
            val = getattr(packet.raw, defn.name)

            if pd.history and defn.name in pd.history:
                val = getattr(packet.history, defn.name)

            if val is not None and not (isinstance(val, float) and math.isnan(val)):
                if isinstance(val, FieldList):
                    fields[defn.name] = val.decode()

kmarwah avatar Apr 11 '22 20:04 kmarwah