diff options
author | Diego <diegolparra@gmail.com> | 2014-07-27 19:02:23 -0300 |
---|---|---|
committer | Diego <diegolparra@gmail.com> | 2014-07-27 19:02:23 -0300 |
commit | dfef9dce52782fb4939556adb926d7ff531d72b3 (patch) | |
tree | a2fd88d635a4e33c6c33c85744b86633a089f74c /kamon-datadog/src/main/scala/kamon/datadog | |
parent | 9ed8b6de50589e9b5cfd3a538d3f2e2e1145970d (diff) | |
download | Kamon-dfef9dce52782fb4939556adb926d7ff531d72b3.tar.gz Kamon-dfef9dce52782fb4939556adb926d7ff531d72b3.tar.bz2 Kamon-dfef9dce52782fb4939556adb926d7ff531d72b3.zip |
kamon-system-metrics: add system metrics to datadog and statsd modules
Diffstat (limited to 'kamon-datadog/src/main/scala/kamon/datadog')
-rw-r--r-- | kamon-datadog/src/main/scala/kamon/datadog/Datadog.scala | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/kamon-datadog/src/main/scala/kamon/datadog/Datadog.scala b/kamon-datadog/src/main/scala/kamon/datadog/Datadog.scala index 1803b833..6498f851 100644 --- a/kamon-datadog/src/main/scala/kamon/datadog/Datadog.scala +++ b/kamon-datadog/src/main/scala/kamon/datadog/Datadog.scala @@ -16,14 +16,17 @@ package kamon.datadog +import java.net.InetSocketAddress +import java.util.concurrent.TimeUnit.MILLISECONDS + import akka.actor._ +import akka.event.Logging import kamon.Kamon import kamon.metric._ -import scala.concurrent.duration._ +import kamon.metrics._ + import scala.collection.JavaConverters._ -import akka.event.Logging -import java.net.InetSocketAddress -import java.util.concurrent.TimeUnit.MILLISECONDS +import scala.concurrent.duration._ object Datadog extends ExtensionId[DatadogExtension] with ExtensionIdProvider { override def lookup(): ExtensionId[_ <: Extension] = Datadog @@ -65,6 +68,14 @@ class DatadogExtension(system: ExtendedActorSystem) extends Kamon.Extension { Kamon(Metrics)(system).subscribe(DispatcherMetrics, dispatcherPathPattern, datadogMetricsListener, permanently = true) } + // Subscribe to SystemMetrics + val includeSystemMetrics = datadogConfig.getBoolean("report-system-metrics") + if (includeSystemMetrics) { + List(CPUMetrics, ProcessCPUMetrics, MemoryMetrics, NetworkMetrics, GCMetrics, HeapMetrics) foreach { metric ⇒ + Kamon(Metrics)(system).subscribe(metric, "*", datadogMetricsListener, permanently = true) + } + } + def buildMetricsListener(tickInterval: Long, flushInterval: Long): ActorRef = { assert(flushInterval >= tickInterval, "Datadog flush-interval needs to be equal or greater to the tick-interval") |