scross01 / prometheus-klipper-exporter

Prometheus Exporter for Klipper
MIT License
48 stars 10 forks source link

runtime error after i/o timeout #31

Closed scross01 closed 3 weeks ago

scross01 commented 1 month ago

Hello again, I am having the same issue when the node is off, triggering an i/o timeout and eventually a nil pointer dereference.

Jul 09 23:55:05 yix prometheus-klipper-exporter[194451]: time="2024-07-09T23:55:05+03:00" level=error msg="Get \"http://my-printer:7125/server/history/totals\": dial tcp [fd7a:115c:a1e0:ab12:4843:cd96:6262:1a38]:7125: i/o timeout"
Jul 09 23:55:05 yix prometheus-klipper-exporter[194451]: panic: runtime error: invalid memory address or nil pointer dereference

Originally posted by @ctrochalakis in https://github.com/scross01/prometheus-klipper-exporter/issues/24#issuecomment-2219743620

scross01 commented 1 month ago

I think I see what the problem could be, if the klipper host stops responding part way through the collection it reports the error, but then carries on assuming it has the required metric data to populate the collector. An updated is needed to catch the exceptions correctly mid collection.

scross01 commented 3 weeks ago

Issue was resolved in v0.11.1