You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2018/11/04 19:41:24 UTC
[pulsar] branch master updated: fix bugs in python instance metrics
(#2925)
This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 36f767f fix bugs in python instance metrics (#2925)
36f767f is described below
commit 36f767f7a7009f35ae8eb0b4fb31bd28e31ef75e
Author: Boyang Jerry Peng <je...@gmail.com>
AuthorDate: Sun Nov 4 11:41:19 2018 -0800
fix bugs in python instance metrics (#2925)
### Motivation
fixing some bugs in the python instance metrics code
---
pulsar-functions/instance/src/main/python/python_instance.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/pulsar-functions/instance/src/main/python/python_instance.py b/pulsar-functions/instance/src/main/python/python_instance.py
index 37a0cb2..fbcc74f 100644
--- a/pulsar-functions/instance/src/main/python/python_instance.py
+++ b/pulsar-functions/instance/src/main/python/python_instance.py
@@ -260,6 +260,7 @@ class PythonInstance(object):
log.add_handler(self.saved_log_handler)
if successfully_executed:
self.process_result(output_object, msg)
+ Stats.stat_total_processed_successfully.labels(*self.metrics_labels).inc()
except Exception as e:
Log.error("Uncaught exception in Python instance: %s" % e);
@@ -329,11 +330,11 @@ class PythonInstance(object):
# Now add system metrics as well
self.add_system_metrics("__total_processed__", Stats.stat_total_processed.labels(*self.metrics_labels)._value.get(), metrics)
self.add_system_metrics("__total_successfully_processed__", Stats.stat_total_processed_successfully.labels(*self.metrics_labels)._value.get(), metrics)
- self.add_system_metrics("__total_system_exceptions__", Stats.stat_total_sys_exceptions._value.labels(*self.metrics_labels).get(), metrics)
- self.add_system_metrics("__total_user_exceptions__", Stats.stat_total_user_exceptions._value.labels(*self.metrics_labels).get(), metrics)
+ self.add_system_metrics("__total_system_exceptions__", Stats.stat_total_sys_exceptions.labels(*self.metrics_labels)._value.get(), metrics)
+ self.add_system_metrics("__total_user_exceptions__", Stats.stat_total_user_exceptions.labels(*self.metrics_labels)._value.get(), metrics)
self.add_system_metrics("__avg_latency_ms__",
- 0.0 if Stats.stats_process_latency_ms._count.labels(*self.metrics_labels).get() <= 0.0
- else Stats.stats_process_latency_ms.labels(*self.metrics_labels)._sum.get() / Stats.stats_process_latency_ms._count.labels(*self.metrics_labels).get(),
+ 0.0 if Stats.stats_process_latency_ms.labels(*self.metrics_labels)._count.get() <= 0.0
+ else Stats.stats_process_latency_ms.labels(*self.metrics_labels)._sum.get() / Stats.stats_process_latency_ms.labels(*self.metrics_labels)._count.get(),
metrics)
return metrics