diff options
Diffstat (limited to 'src/main/scala/kamon/metric/NewRelicReporter.scala')
-rw-r--r-- | src/main/scala/kamon/metric/NewRelicReporter.scala | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/main/scala/kamon/metric/NewRelicReporter.scala b/src/main/scala/kamon/metric/NewRelicReporter.scala new file mode 100644 index 00000000..9aa374aa --- /dev/null +++ b/src/main/scala/kamon/metric/NewRelicReporter.scala @@ -0,0 +1,41 @@ +package kamon.metric + +import com.newrelic.api.agent.NewRelic +import com.yammer.metrics.reporting.AbstractPollingReporter +import com.yammer.metrics.core._ + + +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()) + } + + + def processCounter(name: MetricName, counter: Counter, context: String) {} + + def processHistogram(name: MetricName, histogram: Histogram, context: String) {} + + def processTimer(name: MetricName, timer: Timer, context: String) {} + + 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 (subEntry <- entry.getValue.entrySet) { + subEntry.getValue.processWith(this, subEntry.getKey, "") + } + + } + + } + +} |