diff options
author | Diego Parra <diegolparra@gmail.com> | 2013-05-05 20:33:28 -0300 |
---|---|---|
committer | Diego Parra <diegolparra@gmail.com> | 2013-05-05 20:33:28 -0300 |
commit | 2f81f03742860a0a57cebeea6f0160f3c0d80a48 (patch) | |
tree | 2715ea8499f8245d31976ff2450c47da3cf64f4c /src/main/scala/kamon/metric | |
parent | 2caece9ef7574406c548b4a1f333de4c9579b3a2 (diff) | |
download | Kamon-2f81f03742860a0a57cebeea6f0160f3c0d80a48.tar.gz Kamon-2f81f03742860a0a57cebeea6f0160f3c0d80a48.tar.bz2 Kamon-2f81f03742860a0a57cebeea6f0160f3c0d80a48.zip |
added Mailbox, PoolMonitor and ActorSystem Aspects and fix newRelicReporter
Diffstat (limited to 'src/main/scala/kamon/metric')
-rw-r--r-- | src/main/scala/kamon/metric/Metrics.scala | 5 | ||||
-rw-r--r-- | src/main/scala/kamon/metric/NewRelicReporter.scala | 12 |
2 files changed, 4 insertions, 13 deletions
diff --git a/src/main/scala/kamon/metric/Metrics.scala b/src/main/scala/kamon/metric/Metrics.scala index ecfa0ec6..4cbe25e1 100644 --- a/src/main/scala/kamon/metric/Metrics.scala +++ b/src/main/scala/kamon/metric/Metrics.scala @@ -11,14 +11,13 @@ class Metrics { private lazy val metricsRegistry: MetricsRegistry = new MetricsRegistry() private lazy val metricsGroup = new MetricsGroup(this.getClass, metricsRegistry) - private lazy val meters = new mutable.HashMap[String, Meter] + private lazy val meters = new mutable.HashMap[String, Meter] with SynchronizedMap[String, Meter] private lazy val timers = new HashMap[String, Timer] with SynchronizedMap[String, Timer] private lazy val counters = new HashMap[String, Counter] with SynchronizedMap[String, Counter] - - val consoleReporter = ConsoleReporter.enable(metricsRegistry, 1, TimeUnit.SECONDS) val newrelicReport = new NewRelicReporter(metricsRegistry, "newrelic-reporter"); + newrelicReport.run() newrelicReport.start(1, TimeUnit.SECONDS) diff --git a/src/main/scala/kamon/metric/NewRelicReporter.scala b/src/main/scala/kamon/metric/NewRelicReporter.scala index 9aa374aa..fa6b29f3 100644 --- a/src/main/scala/kamon/metric/NewRelicReporter.scala +++ b/src/main/scala/kamon/metric/NewRelicReporter.scala @@ -3,12 +3,11 @@ package kamon.metric import com.newrelic.api.agent.NewRelic import com.yammer.metrics.reporting.AbstractPollingReporter import com.yammer.metrics.core._ +import scala.collection.JavaConversions._ class NewRelicReporter(registry: MetricsRegistry, name: String) extends AbstractPollingReporter(registry, name) with MetricProcessor[String] { - - def processMeter(name: MetricName, meter: Metered, context: String) { println(s"Logging to NewRelic: ${meter.count()}") NewRelic.recordMetric("Custom/Actor/MessagesPerSecond", meter.count()) @@ -23,19 +22,12 @@ class NewRelicReporter(registry: MetricsRegistry, name: String) extends Abstract def processGauge(name: MetricName, gauge: Gauge[_], context: String) {} - private final val predicate: MetricPredicate = null - def run() { - import scala.collection.JavaConversions._ - for (entry <- getMetricsRegistry.groupedMetrics(predicate).entrySet) { - import scala.collection.JavaConversions._ + for (entry <- getMetricsRegistry.groupedMetrics(MetricPredicate.ALL).entrySet) { for (subEntry <- entry.getValue.entrySet) { subEntry.getValue.processWith(this, subEntry.getKey, "") } - } - } - } |