agrif / OctoPrint-InfluxDB

Writes temperatures and events to an Influx database.
GNU Affero General Public License v3.0
24 stars 15 forks source link

max-values-per-tag limit exceeded #12

Closed rudnerbjoern closed 4 years ago

rudnerbjoern commented 4 years ago

I had running the plugin to report information into a database.

One day during a print octoprint crashed beacause the InfluxDB-plugin does not react on the answer of the InfluxDB server the right way:

2020-04-22 02:06:48,684 - octoprint.plugins.influxdb - ERROR - Disconnected from InfluxDB. Attempting to reconnect. Traceback (most recent call last): File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_influxdb/init.py", line 155, in influx_emit self.influx_db.write_points([point]) File "/home/pi/oprint/local/lib/python2.7/site-packages/influxdb/client.py", line 530, in write_points consistency=consistency) File "/home/pi/oprint/local/lib/python2.7/site-packages/influxdb/client.py", line 598, in _write_points protocol=protocol File "/home/pi/oprint/local/lib/python2.7/site-packages/influxdb/client.py", line 343, in write headers=headers File "/home/pi/oprint/local/lib/python2.7/site-packages/influxdb/client.py", line 302, in request raise InfluxDBClientError(response.content, response.status_code) InfluxDBClientError: 400: {"error":"partial write: max-values-per-tag limit exceeded (100000/100000): measurement=\"octoprint_events\" tag=\"new\" value=\"1.021\" dropped=1"}

2020-04-22 02:06:48,689 - octoprint.plugins.influxdb - INFO - connecting: database='openhab_db', host='192.168.178.21', ssl=False, use_udp=False 2020-04-22 02:06:48,746 - octoprint.plugins.influxdb - INFO - Using existing database openhab_db 2020-04-22 02:06:48,827 - octoprint.plugins.influxdb - ERROR - Disconnected from InfluxDB. Attempting to reconnect. Traceback (most recent call last): File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_influxdb/init.py", line 155, in influx_emit self.influx_db.write_points([point]) File "/home/pi/oprint/local/lib/python2.7/site-packages/influxdb/client.py", line 530, in write_points consistency=consistency) File "/home/pi/oprint/local/lib/python2.7/site-packages/influxdb/client.py", line 598, in _write_points protocol=protocol File "/home/pi/oprint/local/lib/python2.7/site-packages/influxdb/client.py", line 343, in write headers=headers File "/home/pi/oprint/local/lib/python2.7/site-packages/influxdb/client.py", line 302, in request raise InfluxDBClientError(response.content, response.status_code) InfluxDBClientError: 400: {"error":"partial write: max-values-per-tag limit exceeded (100000/100000): measurement=\"octoprint_events\" tag=\"old\" value=\"1.021\" dropped=1"}

2020-04-22 02:06:48,832 - octoprint.plugins.influxdb - INFO - connecting: database='openhab_db', host='192.168.178.21', ssl=False, use_udp=False 2020-04-22 02:06:48,860 - octoprint.plugins.influxdb - INFO - Using existing database openhab_db

As a result of that, octoprint crashed because it could not open now tasks:

2020-04-22 03:38:10,706 - octoprint.util.comm - ERROR - Something crashed inside the serial connection loop, please report this in OctoPrint's bug tracker: Traceback (most recent call last): File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/util/comm.py", line 1781, in _monitor self._handle_resend_request(line) File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/util/comm.py", line 3020, in _handle_resend_request self._resend_ok_timer.start() File "/usr/lib/python2.7/threading.py", line 736, in start _start_new_thread(self.__bootstrap, ()) error: can't start new thread 2020-04-22 03:38:10,748 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Offline (Error: See octoprint.log for details)"

You can find the logfile here: https://gist.github.com/rudnerbjoern/665602d7092fc4168c2e941d0ac3fbec and an issue at octoprint here: https://github.com/OctoPrint/OctoPrint/issues/3532

agrif commented 4 years ago

I'm not sure why I stored those as tags -- I think it was probably the easy way out.

I've made changes to how events are stored: now, the type is stored as a tag (which it always should have been??) and the rest of the payload is stored as fields. This can result in some of the payload being dropped (if it's not a type that can be stored in a field, or if it has a datatype that changes over time) but I think it's a good first approximation.

Also, the plugin should be more well-behaved in situations where it used to disconnect and reconnect very rapidly, which I think is what caused the overall OctoPrint crash. Now it will only attempt to reconnect at most once every 10 seconds.

These changes are in 1.3.0 which should be available for update now. You might want to reset your octoprint database, or at least remove the events measurement, just to clear up space.