DavidLiu 4 luni în urmă
părinte
comite
624319276a
1 a modificat fișierele cu 17 adăugiri și 4 ștergeri
  1. 17 4
      src/core/callcenter/registry.py

+ 17 - 4
src/core/callcenter/registry.py

@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 # encoding:utf-8
 
+import traceback
 # import prometheus_client
 from . import app
 from typing import Iterable
@@ -16,13 +17,25 @@ ESL_EVENT_LATENCY = Histogram('esl_event_latency', 'Esl Event latency in seconds
 
 
 def counter(name, description, labels=None, initial_value_when_only_static_labels=True, **kwargs):
-    return metrics.counter(name, description, labels, initial_value_when_only_static_labels, **kwargs)
+    try:
+        return metrics.counter(name, description, labels, initial_value_when_only_static_labels, **kwargs)
+    except:
+        traceback.print_exc()
 
 def gauge(name, description, labels=None, initial_value_when_only_static_labels=True, **kwargs):
-    return metrics.gauge(name, description, labels, initial_value_when_only_static_labels, **kwargs)
+    try:
+        return metrics.gauge(name, description, labels, initial_value_when_only_static_labels, **kwargs)
+    except:
+        traceback.print_exc()
 
 def histogram(name, description, labels=None, initial_value_when_only_static_labels=True, **kwargs):
-    return metrics.histogram(name, description, labels, initial_value_when_only_static_labels, **kwargs)
+    try:
+        return metrics.histogram(name, description, labels, initial_value_when_only_static_labels, **kwargs)
+    except:
+        traceback.print_exc()
 
 def summary(name, description, labels=None, initial_value_when_only_static_labels=True, **kwargs):
-    return metrics.summary(name, description, labels, initial_value_when_only_static_labels, **kwargs)
+    try:
+        return metrics.summary(name, description, labels, initial_value_when_only_static_labels, **kwargs)
+    except:
+        traceback.print_exc()