There is no snapshot method in that UDF example. I didn’t try that example.
According to my understanding, a UDF has to send a response from snapshot method.
You can try moving average (or any other) example from kapactor github repo.
I am currently having the same issue. I have tried simply using the same code from the init method as the snapshot method. Consequently, the error message did disappear but it didn’t get the stream to reach the proper status and get some bytes. So I’m quite sure it’s only a symptom, not the cause. Any other suggestions maybe? Thank you!
Response from init method is of type/method response.init. so for snapshot, it will response.snapshot.
You can use snapshot method from outlier.py example from Kapacitor repo. You can find template for snapshot and restore.
I have found the problem. The reason why it’s not working is because the tutorial is heavily outdated. The recording tool only records entries, which are inserted into the database after the recording tool has been started. Though this might be true, the timestamp is used to identify which entry is new. So in this case, it the timestamp starts at 1/1/2016 which is not even remotely the current date. I deleted the old lines of datetime code and replaced it with
points.append("%s hotend=%f,bed=%f,air=%f %d" % ( measurement, hotend, bed, air, time.time() + i )) .
Hope I could help.