usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [14/50] incubator-usergrid git commit: add timer and meter to update entity
Date Mon, 16 Mar 2015 23:37:42 GMT
add timer and meter to update entity


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

Branch: refs/heads/two-dot-o
Commit: 06fe6097cb854fa35e9071c87efe8cb7ec8f9f88
Parents: 56c5701
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Wed Mar 11 08:49:13 2015 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Wed Mar 11 08:49:13 2015 -0600

----------------------------------------------------------------------
 .../apache/usergrid/corepersistence/CpEntityManager.java  | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/06fe6097/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
index 1663756..26eff4c 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java
@@ -33,6 +33,7 @@ import java.util.TreeMap;
 import java.util.TreeSet;
 import java.util.UUID;
 
+import com.codahale.metrics.Meter;
 import org.apache.usergrid.persistence.core.future.BetterFuture;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -206,6 +207,8 @@ public class CpEntityManager implements EntityManager {
     private Timer entGetEntityCountersTimer;
     private Timer esIndexEntityCollectionTimer;
     private Timer entRevokeRolePermissionsTimer;
+    private Timer updateEntityTimer;
+    private Meter updateEntityMeter;
 
     //    /** Short-term cache to keep us from reloading same Entity during single request.
*/
 //    private LoadingCache<EntityScope, org.apache.usergrid.persistence.model.entity.Entity>
entityCache;
@@ -267,6 +270,9 @@ public class CpEntityManager implements EntityManager {
         this.entRevokeRolePermissionsTimer =
             this.metricsFactory.getTimer( CpEntityManager.class, "cp.entity.revoke.role.permissions.timer");
 
+        this.updateEntityMeter =this.metricsFactory.getMeter(CpEntityManager.class,"cp.entity.update.meter");
+        this.updateEntityTimer =this.metricsFactory.getTimer(CpEntityManager.class, "cp.entity.update.timer");
+
         // set to false for now
         this.skipAggregateCounters = false;
 
@@ -562,6 +568,9 @@ public class CpEntityManager implements EntityManager {
         Preconditions.checkNotNull(appId,"app scope should never be null");
         // first, update entity index in its own collection scope
 
+        updateEntityMeter.mark();
+        Timer.Context timer = updateEntityTimer.time();
+
         CollectionScope collectionScope = getCollectionScopeNameFromEntityType(appId, type
);
         EntityCollectionManager ecm = managerCache.getEntityCollectionManager( collectionScope
);
 
@@ -618,6 +627,7 @@ public class CpEntityManager implements EntityManager {
         // update in all containing collections and connection indexes
         CpRelationManager rm = ( CpRelationManager ) getRelationManager( entity );
         rm.updateContainingCollectionAndCollectionIndexes( cpEntity );
+        timer.stop();
     }
 
 


Mime
View raw message