You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sf...@apache.org on 2015/06/24 01:59:14 UTC

incubator-usergrid git commit: adding additional metric for sqs message times

Repository: incubator-usergrid
Updated Branches:
  refs/heads/two-dot-o-dev 593d89c59 -> d23ed04bb


adding additional metric for sqs message times


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

Branch: refs/heads/two-dot-o-dev
Commit: d23ed04bbaaa9512ae01bc3dd5738166c6430d26
Parents: 593d89c
Author: Shawn Feldman <sf...@apache.org>
Authored: Tue Jun 23 17:58:55 2015 -0600
Committer: Shawn Feldman <sf...@apache.org>
Committed: Tue Jun 23 17:58:55 2015 -0600

----------------------------------------------------------------------
 .../asyncevents/AmazonAsyncEventService.java                | 5 +++++
 .../asyncevents/InMemoryAsyncEventService.java              | 1 -
 .../corepersistence/asyncevents/model/AsyncEvent.java       | 9 +++++++++
 3 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d23ed04b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AmazonAsyncEventService.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AmazonAsyncEventService.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AmazonAsyncEventService.java
index 5b275c3..2f74dff 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AmazonAsyncEventService.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/AmazonAsyncEventService.java
@@ -25,6 +25,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicLong;
 
+import com.codahale.metrics.Histogram;
 import com.google.common.base.Preconditions;
 import org.apache.usergrid.corepersistence.CpEntityManager;
 import org.apache.usergrid.corepersistence.asyncevents.model.*;
@@ -85,6 +86,7 @@ public class AmazonAsyncEventService implements AsyncEventService {
     private final Counter indexErrorCounter;
     private final AtomicLong counter = new AtomicLong();
     private final AtomicLong inFlight = new AtomicLong();
+    private final Histogram messageCycle;
 
     //the actively running subscription
     private List<Subscription> subscriptions = new ArrayList<>();
@@ -110,6 +112,7 @@ public class AmazonAsyncEventService implements AsyncEventService {
         this.readTimer = metricsFactory.getTimer(AmazonAsyncEventService.class, "async_event.read");
         this.messageProcessingTimer = metricsFactory.getTimer(AmazonAsyncEventService.class, "async_event.message_processing");
         this.indexErrorCounter = metricsFactory.getCounter(AmazonAsyncEventService.class, "async_event.error");
+        this.messageCycle = metricsFactory.getHistogram(AmazonAsyncEventService.class, "async_event.message_cycle");
 
 
         //wire up the gauge of inflight message
@@ -220,6 +223,8 @@ public class AmazonAsyncEventService implements AsyncEventService {
 
                 }
             }
+
+            messageCycle.update( System.currentTimeMillis() - event.getCreationTime() );
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d23ed04b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/InMemoryAsyncEventService.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/InMemoryAsyncEventService.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/InMemoryAsyncEventService.java
index 288b3bc..c3b6ef2 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/InMemoryAsyncEventService.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/InMemoryAsyncEventService.java
@@ -52,7 +52,6 @@ public class InMemoryAsyncEventService implements AsyncEventService {
     private final boolean resolveSynchronously;
 
 
-
     @Inject
     public InMemoryAsyncEventService( final EventBuilder eventBuilder, final RxTaskScheduler rxTaskScheduler, boolean
         resolveSynchronously ) {

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d23ed04b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/model/AsyncEvent.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/model/AsyncEvent.java b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/model/AsyncEvent.java
index 6d11401..66476f9 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/model/AsyncEvent.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/asyncevents/model/AsyncEvent.java
@@ -51,6 +51,9 @@ public class AsyncEvent implements Serializable {
     @JsonProperty
     protected Edge edge;
 
+    @JsonProperty
+    protected long creationTime;
+
     /**
      * required for jackson, do not delete
      */
@@ -63,12 +66,14 @@ public class AsyncEvent implements Serializable {
 
         this.eventType = eventType;
         this.entityIdScope = entityIdScope;
+        this.creationTime = System.currentTimeMillis();
     }
 
     public AsyncEvent(EventType eventType, ApplicationScope applicationScope, Edge edge) {
         this.eventType = eventType;
         this.applicationScope = applicationScope;
         this.edge = edge;
+        this.creationTime = System.currentTimeMillis();
     }
 
     public AsyncEvent(EventType eventType, ApplicationScope applicationScope, Id entityId, Edge edge) {
@@ -76,6 +81,7 @@ public class AsyncEvent implements Serializable {
         this.applicationScope = applicationScope;
         this.edge = edge;
         this.entityId = entityId;
+        this.creationTime = System.currentTimeMillis();
     }
 
     @JsonSerialize()
@@ -119,6 +125,9 @@ public class AsyncEvent implements Serializable {
         return edge;
     }
 
+    @JsonSerialize()
+    public long getCreationTime() {  return creationTime; }
+
     protected void setEdge(Edge edge) {
         this.edge = edge;
     }