Detect write errors on Async UDP

Hello all, I’m using an rpi4 with python to write time series sensor data to influxdb (v2.0.6). I’m using the influxdb-client-python 1.14.0. Most of the time everything is fine. Writes are going in and I can view the data on a grafana dashboard. Occasionally though, writes to the database stop working and only start working with a restart of the python script. The script never fails or raises exceptions, it just keeps chugging along. Similarly the influx server has no errors that I can find.

The sensor data is 8 channels sampled at 558Hz and updated every second. The point data structure is dictionary:

point = {
    "measurement" : <measurement_name>,
    "time" : <time>,
    "tags" : {
        "Channel" : <ch#>,
    },
    "fields" : {
        "value" : <sample_value>
    }
}

The writes are being made with the following where points has a length of 4464:

result = self.write_api.write(self.bucket, self.org, points, write_precision=WritePrecision.NS)

The connection is setup with:

self.client = InfluxDBClient(url="http://{}".format(self.ip_port), token=self.token, use_udp=True, udp_port=4444)
self.write_api = self.client.write_api(write_options=ASYNCHRONOUS)

Is there anyway to detect when writes are failing on async udp writes? I’ve tried checking result.get() but it only ever returns None.

“Is there anyway to detect when writes are failing on async udp writes?”

No. UDP is by definition unreliable - it doesn’t actually stand for Unreliable
Datagram Protocol, but it might as well.

It’s a “fire and forget” method of getting data from one place to another where
the timeliness of each datum’s arrival is more important than the continuity
of the stream (so, think of streaming audio, for example - you can put up with
a half second gap in a conversation which then reverts to real-time far better
than you can with a half-second delay from that point onwards).

For your purpose (and assuming that this is the problem - a packet capture
would help to confirm) I would suggest using TCP instead.

Antony.

Thank you for your reply Pooh. I remember thinking when writing the question, well this is a stoopid question, I’m using UDP. There is no response to check. Truth is I’ve been having intermittent problems with writes using tcp as well. Also with the default batching writes. The biggest problem I’m facing is the lack of any errors on failed writes. Influx is launched as a service and should redirect stderr to /var/log/influxdb/influxd.log, but there is never even a file created at that location. A better question would have been, is there anyway to detect when writes are failing on asynchronous writes? I would like to avoid having to perform a read of the db for verification if at all possible.