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-579: Cloned stream alert event missed stream name
Date Thu, 29 Sep 2016 17:15:31 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 039bf25d6 -> f1cd71e90


EAGLE-579: Cloned stream alert event missed stream name

Author : Li, Garrett
Reviewer : ralphsu

This closes #466


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

Branch: refs/heads/master
Commit: f1cd71e90241f0f6cb6f9b543b50df04239c7aa3
Parents: 039bf25
Author: Xiancheng Li <xiancheng.li@ebay.com>
Authored: Thu Sep 29 21:08:29 2016 +0800
Committer: Ralph, Su <suliangfei@gmail.com>
Committed: Thu Sep 29 10:15:22 2016 -0700

----------------------------------------------------------------------
 .../eagle/alert/engine/publisher/dedup/DedupCache.java |  3 ++-
 .../engine/publisher/dedup/ExtendedDeduplicator.java   | 13 ++++++++++++-
 .../engine/publisher/impl/AbstractPublishPlugin.java   | 10 ++++++----
 .../alert/engine/publisher/dedup/TestDeduplicator.java |  4 ++--
 4 files changed, 22 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/f1cd71e9/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/dedup/DedupCache.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/dedup/DedupCache.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/dedup/DedupCache.java
index 86b13ba..b332047 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/dedup/DedupCache.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/dedup/DedupCache.java
@@ -212,7 +212,7 @@ public class DedupCache {
             DedupValue dedupValue = dedupValues.getLast();
             dedupValue.setCount(dedupValue.getCount() + 1);
             String updateMsg = String.format(
-                "{} Update count for dedup key %s, value %s and count %s", this.publishName,
eventEniq,
+                "%s Update count for dedup key %s, value %s and count %s", this.publishName,
eventEniq,
                 dedupValue.getStateFieldValue(), dedupValue.getCount());
             if (dedupValue.getCount() > 0 && dedupValue.getCount() % 100 == 0)
{
                 LOG.info(updateMsg);
@@ -233,6 +233,7 @@ public class DedupCache {
             newdata[i] = originalEvent.getData()[i];
         }
         event.setData(newdata);
+        event.setStreamId(originalEvent.getStreamId());
         event.setSchema(originalEvent.getSchema());
         event.setPolicyId(originalEvent.getPolicyId());
         event.setCreatedTime(originalEvent.getCreatedTime());

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/f1cd71e9/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/dedup/ExtendedDeduplicator.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/dedup/ExtendedDeduplicator.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/dedup/ExtendedDeduplicator.java
index 9faaed4..ce86ab4 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/dedup/ExtendedDeduplicator.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/dedup/ExtendedDeduplicator.java
@@ -31,12 +31,14 @@ public abstract class ExtendedDeduplicator implements AlertDeduplicator
{
     private List<String> customDedupFields;
     private String dedupStateField;
     private Config config;
+    private String publishName;
 
     public ExtendedDeduplicator(Config config,
                                 Map<String, String> properties,
                                 List<String> customDedupFields,
                                 String dedupStateField,
-                                DedupCache dedupCache) {
+                                DedupCache dedupCache,
+                                String publishName) {
         this.properties = properties;
         if (this.properties == null) {
             this.properties = new HashMap<String, String>();
@@ -45,6 +47,7 @@ public abstract class ExtendedDeduplicator implements AlertDeduplicator
{
         this.customDedupFields = customDedupFields;
         this.dedupStateField = dedupStateField;
         this.config = config;
+        this.publishName = publishName;
     }
 
     public Map<String, String> getProperties() {
@@ -67,4 +70,12 @@ public abstract class ExtendedDeduplicator implements AlertDeduplicator
{
         return config;
     }
 
+    public String getPublishName() {
+        return publishName;
+    }
+
+    public void setPublishName(String publishName) {
+        this.publishName = publishName;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/f1cd71e9/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/AbstractPublishPlugin.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/AbstractPublishPlugin.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/AbstractPublishPlugin.java
index 87aac29..585d92b 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/AbstractPublishPlugin.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/AbstractPublishPlugin.java
@@ -57,14 +57,16 @@ public abstract class AbstractPublishPlugin implements AlertPublishPlugin
{
                     Map.class,
                     List.class,
                     String.class,
-                    DedupCache.class).newInstance(
+                    DedupCache.class,
+                    String.class).newInstance(
                     config,
                     spec.getProperties(),
                     publishment.getDedupFields(),
                     publishment.getDedupStateField(),
-                    dedupCache);
-                getLogger().info("initiliazed extended deduplicator {} with properties {}
successfully",
-                    spec.getClassName(), Joiner.on(",").withKeyValueSeparator(">").join(
+                    dedupCache,
+                    publishment.getName());
+                getLogger().info("{} initiliazed extended deduplicator {} with properties
{} successfully",
+                    publishment.getName(), spec.getClassName(), Joiner.on(",").withKeyValueSeparator(">").join(
                         spec.getProperties() == null ? new HashMap<String, String>()
: spec.getProperties()));
             } catch (Throwable t) {
                 getLogger().error(String.format("initialize extended deduplicator %s failed",
spec.getClassName()), t);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/f1cd71e9/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/publisher/dedup/TestDeduplicator.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/publisher/dedup/TestDeduplicator.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/publisher/dedup/TestDeduplicator.java
index 7e175c8..e60ed2c 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/publisher/dedup/TestDeduplicator.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/test/java/org/apache/eagle/alert/engine/publisher/dedup/TestDeduplicator.java
@@ -33,8 +33,8 @@ import java.util.Map;
 public class TestDeduplicator extends ExtendedDeduplicator {
 
     public TestDeduplicator(Config config, Map<String, String> properties, List<String>
customDedupFields,
-			String dedupStateField, DedupCache dedupCache) {
-		super(config, properties, customDedupFields, dedupStateField, dedupCache);
+			String dedupStateField, DedupCache dedupCache, String publishName) {
+		super(config, properties, customDedupFields, dedupStateField, dedupCache, publishName);
 	}
 
 	private static final Logger LOG = LoggerFactory.getLogger(TestDeduplicator.class);


Mime
View raw message