pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] jerrypeng closed pull request #2928: fix bugs in python metrics
Date Mon, 05 Nov 2018 18:59:46 GMT
jerrypeng closed pull request #2928: fix bugs in python metrics
URL: https://github.com/apache/pulsar/pull/2928
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pulsar-functions/instance/src/main/python/python_instance.py b/pulsar-functions/instance/src/main/python/python_instance.py
index fbcc74fbad..6f74461e85 100644
--- a/pulsar-functions/instance/src/main/python/python_instance.py
+++ b/pulsar-functions/instance/src/main/python/python_instance.py
@@ -104,15 +104,15 @@ def add_sys_exception(self):
     if len(self.latest_sys_exception) > 10:
       self.latest_sys_exception.pop(0)
 
-  def reset(self):
-    self.latest_user_exception.clear()
-    self.latest_sys_exception.clear()
-    self.stat_total_processed._value.set(0.0)
-    self.stat_total_processed_successfully._value.set(0.0)
-    self.stat_total_user_exceptions._value.set(0.0)
-    self.stat_total_sys_exceptions._value.set(0.0)
-    self.stats_process_latency_ms._sum.set(0)
-    self.stats_process_latency_ms._count.set(0);
+  def reset(self, metrics_labels):
+    self.latest_user_exception = []
+    self.latest_sys_exception = []
+    self.stat_total_processed.labels(*metrics_labels)._value.set(0.0)
+    self.stat_total_processed_successfully.labels(*metrics_labels)._value.set(0.0)
+    self.stat_total_user_exceptions.labels(*metrics_labels)._value.set(0.0)
+    self.stat_total_sys_exceptions.labels(*metrics_labels)._value.set(0.0)
+    self.stats_process_latency_ms.labels(*metrics_labels)._sum.set(0)
+    self.stats_process_latency_ms.labels(*metrics_labels)._count.set(0);
     self.last_invocation_time = 0.0
 
 class PythonInstance(object):
@@ -321,7 +321,7 @@ def get_and_reset_metrics(self):
     return metrics
 
   def reset_metrics(self):
-    self.stats.reset()
+    self.stats.reset(self.metrics_labels)
     self.contextimpl.reset_metrics()
 
   def get_metrics(self):


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message