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-578: Make dedup state value case insensitive
Date Thu, 29 Sep 2016 05:30:19 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 89d8e3a09 -> 5e59407eb


EAGLE-578: Make dedup state value case insensitive

Author: Li, Garrett
Reviewer: ralphsu

This closes #465


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

Branch: refs/heads/master
Commit: 5e59407eb71204ae90d81bceae149548fd78c59d
Parents: 89d8e3a
Author: Xiancheng Li <xiancheng.li@ebay.com>
Authored: Thu Sep 29 10:52:07 2016 +0800
Committer: Ralph, Su <suliangfei@gmail.com>
Committed: Wed Sep 28 22:30:33 2016 -0700

----------------------------------------------------------------------
 .../engine/publisher/dedup/DedupCache.java      | 27 ++++++++++----------
 pom.xml                                         |  2 +-
 2 files changed, 15 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/5e59407e/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 b15f93c..86b13ba 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
@@ -20,6 +20,7 @@ import com.google.common.base.Joiner;
 import com.google.common.base.Objects;
 import com.typesafe.config.Config;
 import org.apache.commons.lang.time.DateUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.eagle.alert.engine.coordinator.StreamDefinition;
 import org.apache.eagle.alert.engine.model.AlertStreamEvent;
 import org.apache.eagle.alert.engine.publisher.dedup.DedupEventsStoreFactory.DedupEventsStoreType;
@@ -53,7 +54,7 @@ public class DedupCache {
     private Config config;
 
     private String publishName;
-    
+
     public DedupCache(Config config, String publishName) {
         this.config = config;
         this.publishName = publishName;
@@ -86,10 +87,10 @@ public class DedupCache {
                         }
                     }
                 }, 5, 60, TimeUnit.MINUTES);
+                LOG.info("Create daemon to clean up old removable events periodically");
             }
             caches.add(this);
         }
-        LOG.info("Create daemon to clean up old removable events periodicall");
     }
 
     public Map<EventUniq, ConcurrentLinkedDeque<DedupValue>> getEvents() {
@@ -140,7 +141,7 @@ public class DedupCache {
         if (!events.containsKey(eventEniq)
             || (events.containsKey(eventEniq)
             && events.get(eventEniq).size() > 0
-            && !Objects.equal(stateFieldValue,
+            && !StringUtils.equalsIgnoreCase(stateFieldValue,
             events.get(eventEniq).getLast().getStateFieldValue()))) {
             DedupValue[] dedupValues = this.add(eventEniq, stateFieldValue);
             return dedupValues;
@@ -162,8 +163,8 @@ public class DedupCache {
             dedupValues.add(dedupValue);
             // skip the event which put failed due to concurrency
             events.put(eventEniq, dedupValues);
-            LOG.info("Add new dedup key {}, and value {}", eventEniq, dedupValues);
-        } else if (!Objects.equal(stateFieldValue,
+            LOG.info("{} Add new dedup key {}, and value {}", this.publishName, eventEniq,
dedupValues);
+        } else if (!StringUtils.equalsIgnoreCase(stateFieldValue,
             events.get(eventEniq).getLast().getStateFieldValue())) {
             lastDedupValue = events.get(eventEniq).getLast();
             dedupValue = new DedupValue();
@@ -173,16 +174,16 @@ public class DedupCache {
             if (dedupValues.size() > CACHE_MAX_EVENT_QUEUE_SIZE) {
                 dedupValues = new ConcurrentLinkedDeque<DedupValue>();
                 dedupValues.add(lastDedupValue);
-                LOG.info("Reset dedup key {} to value {} since meets maximum {}",
-                    eventEniq, dedupValue, CACHE_MAX_EVENT_QUEUE_SIZE);
+                LOG.info("{} Reset dedup key {} to value {} since meets maximum {}",
+                    this.publishName, eventEniq, dedupValue, CACHE_MAX_EVENT_QUEUE_SIZE);
             }
             dedupValues.add(dedupValue);
-            LOG.info("Update dedup key {}, and value {}", eventEniq, dedupValue);
+            LOG.info("{} Update dedup key {}, and value {}", this.publishName, eventEniq,
dedupValue);
         }
         if (dedupValue != null) {
             DedupEventsStore accessor = DedupEventsStoreFactory.getStore(type, this.config,
this.publishName);
             accessor.add(eventEniq, events.get(eventEniq));
-            LOG.info("Store dedup key {}, value {} to DB", eventEniq,
+            LOG.info("{} Store dedup key {}, value {} to DB", this.publishName, eventEniq,
                 Joiner.on(",").join(events.get(eventEniq)));
         }
         if (dedupValue == null) {
@@ -198,20 +199,20 @@ public class DedupCache {
     public void persistUpdatedEventUniq(EventUniq eventEniq) {
         DedupEventsStore accessor = DedupEventsStoreFactory.getStore(type, this.config, this.publishName);
         accessor.add(eventEniq, events.get(eventEniq));
-        LOG.info("Store dedup key {}, value {} to DB", eventEniq,
+        LOG.info("{} Store dedup key {}, value {} to DB", this.publishName, eventEniq,
             Joiner.on(",").join(events.get(eventEniq)));
-    } 
+    }
 
     private DedupValue updateCount(EventUniq eventEniq) {
         ConcurrentLinkedDeque<DedupValue> dedupValues = events.get(eventEniq);
         if (dedupValues == null || dedupValues.size() <= 0) {
-            LOG.warn("No dedup values found for {}, cannot update count", eventEniq);
+            LOG.warn("{} No dedup values found for {}, cannot update count", this.publishName,
eventEniq);
             return null;
         } else {
             DedupValue dedupValue = dedupValues.getLast();
             dedupValue.setCount(dedupValue.getCount() + 1);
             String updateMsg = String.format(
-                "Update count for dedup key %s, value %s and count %s", eventEniq,
+                "{} 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);

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/5e59407e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index bf5c7c8..fd8cb52 100755
--- a/pom.xml
+++ b/pom.xml
@@ -206,7 +206,7 @@
         <!-- Serialization -->
         <gson.version>2.2.2</gson.version>
         <guava.version>15.0</guava.version>
-        <fasterxml-jackson.version>2.6.6</fasterxml-jackson.version>
+        <fasterxml-jackson.version>2.5.4</fasterxml-jackson.version>
         <codehaus-jackson.version>1.9.13</codehaus-jackson.version>
         <jsoup.version>1.7.3</jsoup.version>
         <io.netty.version>3.6.7.Final</io.netty.version>


Mime
View raw message