BUG-5280: update transaction statistics 66/57366/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Apr 2017 10:50:20 +0000 (12:50 +0200)
committerRobert Varga <nite@hq.sk>
Thu, 18 May 2017 15:22:52 +0000 (15:22 +0000)
This patch adds statistics-keeping to tell-based protocol code.

Change-Id: I377cd4d9075f96dc69dd74011458fdcf53a65add
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a21acd04ac162c1eb84a997ae0c9ac9df185422c)

opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractFrontendHistory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java

index f6dee7ce7b32705a333fbf7f5cc23f5eb410a5ef..b7bd46c738d8a6fa5f55ecb09933048592b27c30 100644 (file)
@@ -170,16 +170,19 @@ abstract class AbstractFrontendHistory implements Identifiable<LocalHistoryIdent
             throws RequestException {
         if (request instanceof CommitLocalTransactionRequest) {
             LOG.debug("{}: allocating new ready transaction {}", persistenceId(), id);
+            tree.getStats().incrementReadWriteTransactionCount();
             return createReadyTransaction(id, ((CommitLocalTransactionRequest) request).getModification());
         }
         if (request instanceof AbstractReadTransactionRequest) {
             if (((AbstractReadTransactionRequest<?>) request).isSnapshotOnly()) {
                 LOG.debug("{}: allocatint new open snapshot {}", persistenceId(), id);
+                tree.getStats().incrementReadOnlyTransactionCount();
                 return createOpenSnapshot(id);
             }
         }
 
         LOG.debug("{}: allocating new open transaction {}", persistenceId(), id);
+        tree.getStats().incrementReadWriteTransactionCount();
         return createOpenTransaction(id);
     }
 
index cf90b0be1009525c7beeaea0e2981b1cc4f1a298..8f3a467d55de9cb739b6d24a7e5db6cfa34910cb 100644 (file)
@@ -44,6 +44,7 @@ import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifie
 import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
 import org.opendaylight.controller.cluster.datastore.DataTreeCohortActorRegistry.CohortRegistryCommand;
 import org.opendaylight.controller.cluster.datastore.ShardDataTreeCohort.State;
+import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStats;
 import org.opendaylight.controller.cluster.datastore.persisted.AbortTransactionPayload;
 import org.opendaylight.controller.cluster.datastore.persisted.AbstractIdentifiablePayload;
 import org.opendaylight.controller.cluster.datastore.persisted.CloseLocalHistoryPayload;
@@ -1137,4 +1138,8 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
             runOnPendingTransactionsComplete = null;
         }
     }
+
+    ShardStats getStats() {
+        return shard.getShardMBean();
+    }
 }