Merge branch 'master' of ssh://gerrit.onlab.us:29418/onos-next
diff --git a/features/features.xml b/features/features.xml
index f008c14..68fa8c3 100644
--- a/features/features.xml
+++ b/features/features.xml
@@ -11,7 +11,7 @@
<bundle>mvn:io.netty/netty/3.9.2.Final</bundle>
<bundle>mvn:com.hazelcast/hazelcast/3.3</bundle>
- <bundle>mvn:com.codahale.metrics/metrics-core/3.0.2</bundle>
+ <bundle>mvn:io.dropwizard.metrics/metrics-core/3.1.0</bundle>
<bundle>mvn:com.eclipsesource.minimal-json/minimal-json/0.9.1</bundle>
<bundle>mvn:com.esotericsoftware.kryo/kryo/2.24.0</bundle>
diff --git a/utils/misc/pom.xml b/utils/misc/pom.xml
index bb25635..ae47a38 100644
--- a/utils/misc/pom.xml
+++ b/utils/misc/pom.xml
@@ -56,9 +56,9 @@
<artifactId>objenesis</artifactId>
</dependency>
<dependency>
- <groupId>com.codahale.metrics</groupId>
+ <groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
- <version>3.0.2</version>
+ <version>3.1.0</version>
</dependency>
</dependencies>
diff --git a/utils/misc/src/main/java/org/onlab/metrics/MetricsManager.java b/utils/misc/src/main/java/org/onlab/metrics/MetricsManager.java
index 2b13efb..a54093f 100644
--- a/utils/misc/src/main/java/org/onlab/metrics/MetricsManager.java
+++ b/utils/misc/src/main/java/org/onlab/metrics/MetricsManager.java
@@ -1,10 +1,14 @@
package org.onlab.metrics;
+import java.io.File;
+import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
import com.codahale.metrics.Counter;
+import com.codahale.metrics.CsvReporter;
import com.codahale.metrics.Gauge;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.Meter;
@@ -50,19 +54,30 @@
/**
* Registry to hold the Components defined in the system.
*/
- private ConcurrentMap<String, MetricsComponent> componentsRegistry =
- new ConcurrentHashMap<>();
+ private ConcurrentMap<String, MetricsComponent> componentsRegistry;
/**
* Registry for the Metrics objects created in the system.
*/
- private final MetricRegistry metricsRegistry = new MetricRegistry();
+ private final MetricRegistry metricsRegistry;
/**
- * Hide constructor. The only way to get the registry is through the
- * singleton getter.
+ * Default Reporter for this metrics manager.
*/
- private MetricsManager() {}
+ private final CsvReporter reporter;
+
+ public MetricsManager() {
+ this.componentsRegistry = new ConcurrentHashMap<>();
+ this.metricsRegistry = new MetricRegistry();
+
+ this.reporter = CsvReporter.forRegistry(metricsRegistry)
+ .formatFor(Locale.US)
+ .convertRatesTo(TimeUnit.SECONDS)
+ .convertDurationsTo(TimeUnit.MICROSECONDS)
+ .build(new File("/tmp/"));
+
+ reporter.start(10, TimeUnit.SECONDS);
+ }
/**
* Registers a component.