mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
feat(octoprint): motion and notifs
This commit is contained in:
parent
6bf729ffe9
commit
7fe6d48ff0
11 changed files with 263 additions and 47 deletions
39
packages/octoprint/prometheus-exporter-deregister.patch
Normal file
39
packages/octoprint/prometheus-exporter-deregister.patch
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
diff --git a/octoprint_prometheus_exporter/__init__.py b/octoprint_prometheus_exporter/__init__.py
|
||||
--- a/octoprint_prometheus_exporter/__init__.py
|
||||
+++ b/octoprint_prometheus_exporter/__init__.py
|
||||
@@ -53,15 +53,22 @@ class PrometheusExporterPlugin(octoprint.plugin.BlueprintPlugin,
|
||||
self.print_completion_timer = None
|
||||
|
||||
def print_deregister_callback(self, label):
|
||||
- if label != '':
|
||||
+ self.print_progress_label = ''
|
||||
+ if label == '':
|
||||
+ return
|
||||
+ try:
|
||||
self.metrics.print_progress.remove(label)
|
||||
self.metrics.print_time_elapsed.remove(label)
|
||||
self.metrics.print_time_est.remove(label)
|
||||
self.metrics.print_time_left_est.remove(label)
|
||||
- self.print_progress_label = ''
|
||||
+ except Exception as err:
|
||||
+ self._logger.warning(err)
|
||||
|
||||
def slice_deregister_callback(self, label):
|
||||
- self.metrics.slice_progress.remove(label)
|
||||
+ try:
|
||||
+ self.metrics.slice_progress.remove(label)
|
||||
+ except Exception as err:
|
||||
+ self._logger.warning(err)
|
||||
|
||||
def print_complete(self):
|
||||
self.metrics.printing_time_total.inc(time.time() - self.print_time_start)
|
||||
@@ -74,7 +81,8 @@ class PrometheusExporterPlugin(octoprint.plugin.BlueprintPlugin,
|
||||
|
||||
self.print_completion_timer = Timer(30, self.print_complete_callback)
|
||||
self.print_completion_timer.start()
|
||||
- Timer(30, lambda: self.print_deregister_callback(self.print_progress_label)).start()
|
||||
+ print_progress_label = self.print_progress_label
|
||||
+ Timer(30, lambda: self.print_deregister_callback(print_progress_label)).start()
|
||||
|
||||
def deactivateMetricsIfOffline(self, payload):
|
||||
if payload['state_id'] == 'OFFLINE':
|
||||
Loading…
Add table
Add a link
Reference in a new issue