Logging improvements
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/e3285843 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/e3285843 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/e3285843 Branch: refs/heads/master Commit: e3285843260c361b3126c5d235068d38802ff164 Parents: d215328 Author: Dave Johnson <snoopd...@apache.org> Authored: Wed Oct 5 17:42:21 2016 -0400 Committer: Dave Johnson <snoopd...@apache.org> Committed: Wed Oct 5 17:42:21 2016 -0400 ---------------------------------------------------------------------- .../persistence/qakka/MetricsService.java | 20 ++++----- .../qakka/core/impl/InMemoryQueue.java | 2 +- .../distributed/actors/QueueActorHelper.java | 37 +---------------- .../queue/LegacyQueueManagerTest.java | 43 ++++++++++---------- 4 files changed, 33 insertions(+), 69 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/e3285843/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/qakka/MetricsService.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/qakka/MetricsService.java b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/qakka/MetricsService.java index 378ba0d..b032be6 100644 --- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/qakka/MetricsService.java +++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/qakka/MetricsService.java @@ -24,16 +24,16 @@ import com.codahale.metrics.MetricRegistry; public interface MetricsService { - String SEND_TIME_TOTAL = "org.apache.usergrid.persistence.qakka.send.time.total"; - String SEND_TIME_SEND = "org.apache.usergrid.persistence.qakka.send.time.send"; - String SEND_TIME_WRITE = "org.apache.usergrid.persistence.qakka.send.time.write"; - String GET_TIME_TOTAL = "org.apache.usergrid.persistence.qakka.get.time.total"; - String GET_TIME_GET = "org.apache.usergrid.persistence.qakka.get.time.get"; - String ACK_TIME_TOTAL = "org.apache.usergrid.persistence.qakka.ack.time.total"; - String ACK_TIME_ACK = "org.apache.usergrid.persistence.qakka.ack.time.ack"; - String TIMEOUT_TIME = "org.apache.usergrid.persistence.qakka.timeout.time"; - String REFRESH_TIME = "org.apache.usergrid.persistence.qakka.timeout.time"; - String ALLOCATE_TIME = "org.apache.usergrid.persistence.qakka.allocate.time"; + String SEND_TIME_TOTAL = "qakka.send.time.total"; + String SEND_TIME_SEND = "qakka.send.time.send"; + String SEND_TIME_WRITE = "qakka.send.time.write"; + String GET_TIME_TOTAL = "qakka.get.time.total"; + String GET_TIME_GET = "qakka.get.time.get"; + String ACK_TIME_TOTAL = "qakka.ack.time.total"; + String ACK_TIME_ACK = "qakka.ack.time.ack"; + String TIMEOUT_TIME = "qakka.timeout.time"; + String REFRESH_TIME = "qakka.refresh.time"; + String ALLOCATE_TIME = "qakka.allocate.time"; MetricRegistry getMetricRegistry(); } http://git-wip-us.apache.org/repos/asf/usergrid/blob/e3285843/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/qakka/core/impl/InMemoryQueue.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/qakka/core/impl/InMemoryQueue.java b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/qakka/core/impl/InMemoryQueue.java index e70ec75..6a26483 100644 --- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/qakka/core/impl/InMemoryQueue.java +++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/qakka/core/impl/InMemoryQueue.java @@ -65,7 +65,7 @@ public class InMemoryQueue { } else { if ( databaseQueueMessage.getQueueMessageId().timestamp() > newest.timestamp() ) { newest = databaseQueueMessage.getQueueMessageId(); - logger.debug("New newest for queue {} is {}", queueName, newest.timestamp()); + //logger.debug("New newest for queue {} is {}", queueName, newest.timestamp()); } } http://git-wip-us.apache.org/repos/asf/usergrid/blob/e3285843/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/qakka/distributed/actors/QueueActorHelper.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/qakka/distributed/actors/QueueActorHelper.java b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/qakka/distributed/actors/QueueActorHelper.java index 0b31e16..e3996c5 100644 --- a/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/qakka/distributed/actors/QueueActorHelper.java +++ b/stack/corepersistence/queue/src/main/java/org/apache/usergrid/persistence/qakka/distributed/actors/QueueActorHelper.java @@ -119,7 +119,7 @@ public class QueueActorHelper { } } - //logger.debug("{} returning {} for queue {}", this, queueMessages.size(), queueName); + logger.debug("{} returning {} for queue {}", this, queueMessages.size(), queueName); return queueMessages; } @@ -251,12 +251,6 @@ public class QueueActorHelper { UUID since = inMemoryQueue.getNewest( queueName ); -// if ( since != null ) { -// logger.debug( "Loading queue {} messages newer than {}", queueName, since.timestamp() ); -// } else { -// logger.debug( "Loading queue {} messages newer than [null]", queueName ); -// } - String region = actorSystemFig.getRegionLocal(); MultiShardMessageIterator multiShardIterator = new MultiShardMessageIterator( cassandraClient, queueName, region, DatabaseQueueMessage.Type.DEFAULT, @@ -271,35 +265,6 @@ public class QueueActorHelper { count++; } -// long runs = runCount.incrementAndGet(); -// long readCount = totalRead.addAndGet( count ); -// -// if ( logger.isDebugEnabled() && runs % 100 == 0 ) { -// -// final DecimalFormat format = new DecimalFormat("##.###"); -// final long nano = 1000000000; -// Timer t = metricsService.getMetricRegistry().timer( MetricsService.REFRESH_TIME ); -// -// logger.debug("QueueRefresher for queue '{}' stats:\n" + -// " Num runs={}\n" + -// " Read count={}\n" + -// " Mean={}\n" + -// " One min rate={}\n" + -// " Five min rate={}\n" + -// " Snapshot mean={}\n" + -// " Snapshot min={}\n" + -// " Snapshot max={}", -// queueName, -// t.getCount(), -// readCount, -// format.format( t.getMeanRate() ), -// format.format( t.getOneMinuteRate() ), -// format.format( t.getFiveMinuteRate() ), -// format.format( t.getSnapshot().getMean() / nano ), -// format.format( (double) t.getSnapshot().getMin() / nano ), -// format.format( (double) t.getSnapshot().getMax() / nano ) ); -// } - if ( count > 0 ) { logger.debug( "Added {} in-memory for queue {}, new size = {}", count, queueName, inMemoryQueue.size( queueName ) ); http://git-wip-us.apache.org/repos/asf/usergrid/blob/e3285843/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/LegacyQueueManagerTest.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/LegacyQueueManagerTest.java b/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/LegacyQueueManagerTest.java index 65c3309..92075b6 100644 --- a/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/LegacyQueueManagerTest.java +++ b/stack/corepersistence/queue/src/test/java/org/apache/usergrid/persistence/queue/LegacyQueueManagerTest.java @@ -29,7 +29,6 @@ import org.apache.usergrid.persistence.qakka.core.CassandraClient; import org.apache.usergrid.persistence.qakka.core.CassandraClientImpl; import org.apache.usergrid.persistence.qakka.distributed.DistributedQueueService; import org.apache.usergrid.persistence.queue.impl.LegacyQueueScopeImpl; -import org.junit.Ignore; import org.junit.Test; import java.util.ArrayList; @@ -143,41 +142,41 @@ public class LegacyQueueManagerTest extends AbstractTest { final LegacyQueueScopeImpl scope = new LegacyQueueScopeImpl( "testQueue" + queueSeed++, LegacyQueueScope.RegionImplementation.LOCAL ); LegacyQueueManagerFactory qmf = myInjector.getInstance( LegacyQueueManagerFactory.class ); - LegacyQueueManager qm = qmf.getQueueManager(scope); + LegacyQueueManager qm = qmf.getQueueManager( scope ); - HashMap<String,String> values = new HashMap<>(); - values.put("test", "Test"); + HashMap<String, String> values = new HashMap<>(); + values.put( "test", "Test" ); - List<Map<String,String>> bodies = new ArrayList<>(); - bodies.add(values); + List<Map<String, String>> bodies = new ArrayList<>(); + bodies.add( values ); long initialDepth = qm.getQueueDepth(); - qm.sendMessages(bodies); + qm.sendMessages( bodies ); long depth = 0; - for(int i=0; i<10;i++){ - depth = qm.getQueueDepth(); - if(depth>0){ + for (int i = 0; i < 10; i++) { + depth = qm.getQueueDepth(); + if (depth > 0) { break; } - Thread.sleep(1000); + Thread.sleep( 1000 ); } - assertTrue(depth>0); + assertTrue( depth > 0 ); - List<LegacyQueueMessage> messageList = qm.getMessages(10, values.getClass()); - assertTrue(messageList.size() <= 500); - for(LegacyQueueMessage message : messageList){ - assertTrue(message.getBody().equals(values)); + List<LegacyQueueMessage> messageList = qm.getMessages( 10, values.getClass() ); + assertTrue( messageList.size() <= 500 ); + for (LegacyQueueMessage message : messageList) { + assertTrue( message.getBody().equals( values ) ); } - if(messageList.size()>0) { - qm.commitMessages(messageList); + if (messageList.size() > 0) { + qm.commitMessages( messageList ); } - for(int i=0; i<10;i++){ + for (int i = 0; i < 10; i++) { depth = qm.getQueueDepth(); - if(depth==initialDepth){ + if (depth == initialDepth) { break; } - Thread.sleep(1000); + Thread.sleep( 1000 ); } - assertEquals(initialDepth, depth); + assertEquals( initialDepth, depth ); DistributedQueueService distributedQueueService = myInjector.getInstance( DistributedQueueService.class ); distributedQueueService.shutdown();