This is an automated email from the ASF dual-hosted git repository.

huijun pushed a commit to branch huijunw/healthmgrmetrics
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git


The following commit(s) were added to refs/heads/huijunw/healthmgrmetrics by 
this push:
     new 53143ba  update sensor with guice singleton
53143ba is described below

commit 53143ba90de2f91ba5fb91000fe793029f906fb9
Author: Huijun Wu <huij...@twitter.com>
AuthorDate: Thu Apr 12 04:13:31 2018 -0700

    update sensor with guice singleton
---
 .../org/apache/heron/healthmgr/sensors/BackPressureSensor.java   | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git 
a/heron/healthmgr/src/java/org/apache/heron/healthmgr/sensors/BackPressureSensor.java
 
b/heron/healthmgr/src/java/org/apache/heron/healthmgr/sensors/BackPressureSensor.java
index b3ac8aa..6ab4ee3 100644
--- 
a/heron/healthmgr/src/java/org/apache/heron/healthmgr/sensors/BackPressureSensor.java
+++ 
b/heron/healthmgr/src/java/org/apache/heron/healthmgr/sensors/BackPressureSensor.java
@@ -40,16 +40,19 @@ public class BackPressureSensor extends BaseSensor {
   private final MetricsProvider metricsProvider;
   private final PackingPlanProvider packingPlanProvider;
   private final TopologyProvider topologyProvider;
+  private HealthManagerMetrics publishingMetricsRunnable;
 
   @Inject
   public BackPressureSensor(PackingPlanProvider packingPlanProvider,
                             TopologyProvider topologyProvider,
                             HealthPolicyConfig policyConfig,
-                            MetricsProvider metricsProvider) {
+                            MetricsProvider metricsProvider,
+                            HealthManagerMetrics publishingMetricsRunnable) {
     super(policyConfig, METRIC_BACK_PRESSURE.text(), 
BackPressureSensor.class.getSimpleName());
     this.packingPlanProvider = packingPlanProvider;
     this.topologyProvider = topologyProvider;
     this.metricsProvider = metricsProvider;
+    this.publishingMetricsRunnable = publishingMetricsRunnable;
   }
 
   /**
@@ -59,9 +62,7 @@ public class BackPressureSensor extends BaseSensor {
    */
   @Override
   public Collection<Measurement> fetch() {
-    ((HealthManagerMetrics) SingletonRegistry.INSTANCE
-        .getSingleton(HealthManagerMetrics.METRICS_THREAD))
-        .executeSensorIncr(BACKPRESSURE_SENSOR);
+    publishingMetricsRunnable.executeSensorIncr(BACKPRESSURE_SENSOR);
 
     Collection<Measurement> result = new ArrayList<>();
     Instant now = context.checkpoint();

-- 
To stop receiving notification emails like this one, please contact
hui...@apache.org.

Reply via email to