pankaj

Report metrics to log

...@@ -24,7 +24,7 @@ public class SimpleNettyClientCommand extends AbstractShellCommand { ...@@ -24,7 +24,7 @@ public class SimpleNettyClientCommand extends AbstractShellCommand {
24 24
25 @Argument(index = 1, name = "warmupCount", description = "Warm-up count", 25 @Argument(index = 1, name = "warmupCount", description = "Warm-up count",
26 required = false, multiValued = false) 26 required = false, multiValued = false)
27 - String warmup = "10000"; 27 + String warmup = "1000";
28 28
29 @Argument(index = 2, name = "messageCount", description = "Message count", 29 @Argument(index = 2, name = "messageCount", description = "Message count",
30 required = false, multiValued = false) 30 required = false, multiValued = false)
......
...@@ -8,7 +8,7 @@ import org.slf4j.LoggerFactory; ...@@ -8,7 +8,7 @@ import org.slf4j.LoggerFactory;
8 * Test to measure Messaging performance. 8 * Test to measure Messaging performance.
9 */ 9 */
10 public final class SimpleNettyServer { 10 public final class SimpleNettyServer {
11 - private static Logger log = LoggerFactory.getLogger(IOLoopTestServer.class); 11 + private static Logger log = LoggerFactory.getLogger(SimpleNettyServer.class);
12 12
13 private SimpleNettyServer() {} 13 private SimpleNettyServer() {}
14 14
......
...@@ -8,8 +8,9 @@ import java.util.concurrent.TimeUnit; ...@@ -8,8 +8,9 @@ import java.util.concurrent.TimeUnit;
8 import org.apache.felix.scr.annotations.Activate; 8 import org.apache.felix.scr.annotations.Activate;
9 import org.apache.felix.scr.annotations.Component; 9 import org.apache.felix.scr.annotations.Component;
10 import org.apache.felix.scr.annotations.Deactivate; 10 import org.apache.felix.scr.annotations.Deactivate;
11 +import org.slf4j.Logger;
12 +import org.slf4j.LoggerFactory;
11 13
12 -import com.codahale.metrics.ConsoleReporter;
13 import com.codahale.metrics.Counter; 14 import com.codahale.metrics.Counter;
14 import com.codahale.metrics.Gauge; 15 import com.codahale.metrics.Gauge;
15 import com.codahale.metrics.Histogram; 16 import com.codahale.metrics.Histogram;
...@@ -17,6 +18,7 @@ import com.codahale.metrics.Meter; ...@@ -17,6 +18,7 @@ import com.codahale.metrics.Meter;
17 import com.codahale.metrics.Metric; 18 import com.codahale.metrics.Metric;
18 import com.codahale.metrics.MetricFilter; 19 import com.codahale.metrics.MetricFilter;
19 import com.codahale.metrics.MetricRegistry; 20 import com.codahale.metrics.MetricRegistry;
21 +import com.codahale.metrics.Slf4jReporter;
20 import com.codahale.metrics.Timer; 22 import com.codahale.metrics.Timer;
21 23
22 /** 24 /**
...@@ -54,6 +56,7 @@ import com.codahale.metrics.Timer; ...@@ -54,6 +56,7 @@ import com.codahale.metrics.Timer;
54 @Component(immediate = true) 56 @Component(immediate = true)
55 public final class MetricsManager implements MetricsService { 57 public final class MetricsManager implements MetricsService {
56 58
59 + private final Logger log = LoggerFactory.getLogger(getClass());
57 /** 60 /**
58 * Registry to hold the Components defined in the system. 61 * Registry to hold the Components defined in the system.
59 */ 62 */
...@@ -67,14 +70,16 @@ public final class MetricsManager implements MetricsService { ...@@ -67,14 +70,16 @@ public final class MetricsManager implements MetricsService {
67 /** 70 /**
68 * Default Reporter for this metrics manager. 71 * Default Reporter for this metrics manager.
69 */ 72 */
70 - private final ConsoleReporter reporter; 73 + private final Slf4jReporter reporter;
71 74
72 public MetricsManager() { 75 public MetricsManager() {
73 this.metricsRegistry = new MetricRegistry(); 76 this.metricsRegistry = new MetricRegistry();
74 - this.reporter = ConsoleReporter.forRegistry(metricsRegistry) 77 + this.reporter = Slf4jReporter.forRegistry(this.metricsRegistry)
78 + .outputTo(log)
75 .convertRatesTo(TimeUnit.SECONDS) 79 .convertRatesTo(TimeUnit.SECONDS)
76 - .convertDurationsTo(TimeUnit.MICROSECONDS) 80 + .convertDurationsTo(TimeUnit.MILLISECONDS)
77 .build(); 81 .build();
82 + reporter.start(1, TimeUnit.MINUTES);
78 } 83 }
79 84
80 @Activate 85 @Activate
......