eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ralp...@apache.org
Subject incubator-eagle git commit: EAGLE-671: incorrect metric system use : too many metric object create and registered
Date Mon, 24 Oct 2016 02:47:37 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 8bd30aec1 -> 56e7048ff


EAGLE-671: incorrect metric system use : too many metric object create and registered

Author: Zeng, Bryant
Reviewer: ralphsu

This closes #554


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/56e7048f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/56e7048f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/56e7048f

Branch: refs/heads/master
Commit: 56e7048ff75a9d8865173961e1537daf18eeb41c
Parents: 8bd30ae
Author: mizeng <mizeng@ebaysf.com>
Authored: Mon Oct 24 10:29:03 2016 +0800
Committer: Ralph, Su <suliangfei@gmail.com>
Committed: Mon Oct 24 10:48:21 2016 +0800

----------------------------------------------------------------------
 .../eagle/alert/engine/runner/AlertBolt.java    | 33 ++------------------
 1 file changed, 2 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/56e7048f/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
index fbee580..d85f76b 100755
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/runner/AlertBolt.java
@@ -16,6 +16,7 @@
  */
 package org.apache.eagle.alert.engine.runner;
 
+import backtype.storm.metric.api.IMetric;
 import org.apache.eagle.alert.coordination.model.AlertBoltSpec;
 import org.apache.eagle.alert.coordination.model.WorkSlot;
 import org.apache.eagle.alert.engine.AlertStreamCollector;
@@ -31,8 +32,6 @@ import org.apache.eagle.alert.engine.model.PartitionedEvent;
 import org.apache.eagle.alert.engine.router.AlertBoltSpecListener;
 import org.apache.eagle.alert.engine.serialization.SerializationMetadataProvider;
 import org.apache.eagle.alert.engine.utils.SingletonExecutor;
-import org.apache.eagle.alert.metric.MetricSystem;
-import org.apache.eagle.alert.metric.source.MetricSource;
 import org.apache.eagle.alert.service.IMetadataServiceClient;
 import org.apache.eagle.alert.service.MetadataServiceClientImpl;
 import org.apache.eagle.alert.utils.AlertConstants;
@@ -43,8 +42,6 @@ import backtype.storm.task.TopologyContext;
 import backtype.storm.topology.OutputFieldsDeclarer;
 import backtype.storm.tuple.Fields;
 import backtype.storm.tuple.Tuple;
-import com.codahale.metrics.Gauge;
-import com.codahale.metrics.MetricRegistry;
 import com.typesafe.config.Config;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -79,28 +76,6 @@ public class AlertBolt extends AbstractStreamBolt implements AlertBoltSpecListen
         // TODO next stage evaluator
     }
 
-    private class MetaConflictMetricSource implements MetricSource {
-        private MetricRegistry registry = new MetricRegistry();
-
-        public MetaConflictMetricSource() {
-            registry.register("meta.conflict", (Gauge<String>) () -> "meta conflict
happening!");
-        }
-
-        public MetaConflictMetricSource(String message) {
-            registry.register("meta.conflict", (Gauge<String>) () -> message);
-        }
-
-        @Override
-        public String name() {
-            return "metaConflict";
-        }
-
-        @Override
-        public MetricRegistry registry() {
-            return registry;
-        }
-    }
-
     @Override
     public void execute(Tuple input) {
         this.streamContext.counter().scope("execute_count").incr();
@@ -129,11 +104,7 @@ public class AlertBolt extends AbstractStreamBolt implements AlertBoltSpecListen
                 LOG.warn(message);
 
                 // send out metrics for meta conflict
-                MetricSystem system = MetricSystem.load(this.getConfig());
-                system.register(new MetaConflictMetricSource(message));
-                system.start();
-                system.report();
-                system.stop();
+                this.streamContext.counter().scope("meta_conflict").incr();
 
                 ExecutorService executors = SingletonExecutor.getExecutorService();
                 executors.submit(() -> {


Mime
View raw message