usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject [20/31] incubator-usergrid git commit: move timers up
Date Mon, 09 Mar 2015 15:25:33 GMT
move timers up


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

Branch: refs/heads/USERGRID-405
Commit: ef550fa380c4aa3422e907ad024194ad9bb29a6f
Parents: d542909
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Fri Mar 6 17:20:32 2015 -0700
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Fri Mar 6 17:20:32 2015 -0700

----------------------------------------------------------------------
 .../corepersistence/CpRelationManager.java      | 23 +++++++++++++-------
 1 file changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/ef550fa3/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
index f5d59d9..d018324 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/CpRelationManager.java
@@ -190,6 +190,10 @@ public class CpRelationManager implements RelationManager {
     private ResultsLoaderFactory resultsLoaderFactory;
 
     private MetricsFactory metricsFactory;
+    private Timer updateCollectionTimer;
+    private Timer createConnectionTimer;
+    private Timer cassConnectionDelete;
+    private Timer esDeleteConnectionTimer;
 
     public CpRelationManager() {}
 
@@ -221,7 +225,13 @@ public class CpRelationManager implements RelationManager {
         this.cass = em.getCass(); // TODO: eliminate need for this via Core Persistence
         this.indexBucketLocator = indexBucketLocator; // TODO: this also
         this.metricsFactory = metricsFactory;
-
+        this.updateCollectionTimer = metricsFactory
+            .getTimer( CpRelationManager.class, "relation.manager.es.update.collection" );
+        this.createConnectionTimer = metricsFactory
+            .getTimer( CpRelationManager.class, "relation.manager.es.create.connection.timer"
);
+        this.cassConnectionDelete = metricsFactory
+            .getTimer( CpRelationManager.class, "relation.manager.cassandra.delete.connection.batch.timer"
);
+        this.esDeleteConnectionTimer = metricsFactory.getTimer(CpRelationManager.class, "relation.manager.es.delete.connection.batch.timer"
);
         // load the Core Persistence version of the head entity as well
         this.headEntityScope = getCollectionScopeNameFromEntityType(
                 applicationScope.getApplication(), headEntity.getType());
@@ -445,8 +455,7 @@ public class CpRelationManager implements RelationManager {
                 } ).count().toBlocking().lastOrDefault( 0 );
 
         //Adding graphite metrics
-        Timer.Context timeElasticIndexBatch = metricsFactory
-            .getTimer( CpRelationManager.class, "relation.manager.es.update.collection" ).time();
+        Timer.Context timeElasticIndexBatch = updateCollectionTimer.time();
         entityIndexBatch.execute();
         timeElasticIndexBatch.stop();
 
@@ -1072,8 +1081,7 @@ public class CpRelationManager implements RelationManager {
         Mutator<ByteBuffer> m = createMutator( ko, be );
         batchUpdateEntityConnection( m, false, connection, UUIDGenerator.newTimeUUID() );
         //Added Graphite Metrics
-        Timer.Context timeElasticIndexBatch = metricsFactory
-            .getTimer( CpRelationManager.class, "relation.manager.es.create.connection.timer"
).time();
+        Timer.Context timeElasticIndexBatch = createConnectionTimer.time();
         batchExecute( m, CassandraService.RETRY_COUNT );
         timeElasticIndexBatch.stop();
 
@@ -1249,8 +1257,7 @@ public class CpRelationManager implements RelationManager {
                 m, true, ( ConnectionRefImpl ) connectionRef, UUIDGenerator.newTimeUUID()
);
 
         //Added Graphite Metrics
-        Timer.Context timeDeleteConnections = metricsFactory
-            .getTimer( CpRelationManager.class, "relation.manager.cassandra.delete.connection.batch.timer"
).time();
+        Timer.Context timeDeleteConnections = cassConnectionDelete.time();
         batchExecute( m, CassandraService.RETRY_COUNT );
         timeDeleteConnections.stop();
 
@@ -1308,7 +1315,7 @@ public class CpRelationManager implements RelationManager {
 //        batch.deindex( allTypesIndexScope, targetEntity );
 
         //Added Graphite Metrics
-        Timer.Context timeDeleteConnection = metricsFactory.getTimer( CpRelationManager.class,
"relation.manager.es.delete.connection.batch.timer" ).time();
+        Timer.Context timeDeleteConnection = esDeleteConnectionTimer.time();
         batch.execute();
         timeDeleteConnection.stop();
 


Mime
View raw message