aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Ferreira <jtjeferreira@gmail.com>2016-01-24 16:24:16 +0000
committerJoão Ferreira <jtjeferreira@gmail.com>2016-01-24 16:27:07 +0000
commitc1e03d38641100e683f1ad60035841b7091ca3ed (patch)
tree47629fc9ecfcbc24a4c40d097ba3c9c245a67757
parent941ec4d75791c58d6a29b73d080f34973b9fab80 (diff)
downloadKamon-c1e03d38641100e683f1ad60035841b7091ca3ed.tar.gz
Kamon-c1e03d38641100e683f1ad60035841b7091ca3ed.tar.bz2
Kamon-c1e03d38641100e683f1ad60035841b7091ca3ed.zip
+ log-reporter: add akka-router subscription
-rw-r--r--.gitignore2
-rw-r--r--kamon-log-reporter/src/main/scala/kamon/logreporter/LogReporter.scala44
2 files changed, 46 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index c91919e0..80d4e720 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,6 +28,8 @@ project/plugins/project/
.settings
.classpath
.cache
+.cache-main
+.cache-tests
bin/
_site
diff --git a/kamon-log-reporter/src/main/scala/kamon/logreporter/LogReporter.scala b/kamon-log-reporter/src/main/scala/kamon/logreporter/LogReporter.scala
index 96995c00..c1a23f1d 100644
--- a/kamon-log-reporter/src/main/scala/kamon/logreporter/LogReporter.scala
+++ b/kamon-log-reporter/src/main/scala/kamon/logreporter/LogReporter.scala
@@ -36,6 +36,7 @@ class LogReporterExtension(system: ExtendedActorSystem) extends Kamon.Extension
Kamon.metrics.subscribe("trace", "**", subscriber, permanently = true)
Kamon.metrics.subscribe("akka-actor", "**", subscriber, permanently = true)
+ Kamon.metrics.subscribe("akka-router", "**", subscriber, permanently = true)
Kamon.metrics.subscribe("akka-dispatcher", "**", subscriber, permanently = true)
Kamon.metrics.subscribe("counter", "**", subscriber, permanently = true)
Kamon.metrics.subscribe("histogram", "**", subscriber, permanently = true)
@@ -61,6 +62,7 @@ class LogReporterSubscriber extends Actor with ActorLogging {
tick.metrics foreach {
case (entity, snapshot) if entity.category == "akka-actor" ⇒ logActorMetrics(entity.name, snapshot)
+ case (entity, snapshot) if entity.category == "akka-router" ⇒ logRouterMetrics(entity.name, snapshot)
case (entity, snapshot) if entity.category == "akka-dispatcher" ⇒ logDispatcherMetrics(entity, snapshot)
case (entity, snapshot) if entity.category == "trace" ⇒ logTraceMetrics(entity.name, snapshot)
case (entity, snapshot) if entity.category == "histogram" ⇒ histograms += (entity.name -> snapshot.histogram("histogram"))
@@ -113,6 +115,48 @@ class LogReporterSubscriber extends Actor with ActorLogging {
}
+ def logRouterMetrics(name: String, actorSnapshot: EntitySnapshot): Unit = {
+ for {
+ processingTime ← actorSnapshot.histogram("processing-time")
+ timeInMailbox ← actorSnapshot.histogram("time-in-mailbox")
+ routingTime ← actorSnapshot.histogram("routing-time")
+ errors ← actorSnapshot.counter("errors")
+ } {
+
+ log.info(
+ """
+ |+--------------------------------------------------------------------------------------------------+
+ || |
+ || Router: %-83s |
+ || |
+ || Processing Time (nanoseconds) Time in Mailbox (nanoseconds) Routing Time (nanoseconds) |
+ || Msg Count: %-12s Msg Count: %-12s Msg Count: %-12s |
+ || Min: %-12s Min: %-12s Min: %-12s |
+ || 50th Perc: %-12s 50th Perc: %-12s 50th Perc: %-12s |
+ || 90th Perc: %-12s 90th Perc: %-12s 90th Perc: %-12s |
+ || 95th Perc: %-12s 95th Perc: %-12s 95th Perc: %-12s |
+ || 99th Perc: %-12s 99th Perc: %-12s 99th Perc: %-12s |
+ || 99.9th Perc: %-12s 99.9th Perc: %-12s 99.9th Perc: %-12s |
+ || Max: %-12s Max: %-12s Max: %-12s |
+ || |
+ || Error Count: %-6s |
+ || |
+ |+--------------------------------------------------------------------------------------------------+"""
+ .stripMargin.format(
+ name,
+ processingTime.numberOfMeasurements, timeInMailbox.numberOfMeasurements, routingTime.numberOfMeasurements,
+ processingTime.min, timeInMailbox.min, routingTime.min,
+ processingTime.percentile(50.0D), timeInMailbox.percentile(50.0D), routingTime.percentile(50.0D),
+ processingTime.percentile(90.0D), timeInMailbox.percentile(90.0D), routingTime.percentile(90.0D),
+ processingTime.percentile(95.0D), timeInMailbox.percentile(95.0D), routingTime.percentile(95.0D),
+ processingTime.percentile(99.0D), timeInMailbox.percentile(99.0D), routingTime.percentile(99.0D),
+ processingTime.percentile(99.9D), timeInMailbox.percentile(99.9D), routingTime.percentile(99.9D),
+ processingTime.max, timeInMailbox.max, routingTime.max,
+ errors.count))
+ }
+
+ }
+
def logDispatcherMetrics(entity: Entity, snapshot: EntitySnapshot): Unit = entity.tags.get("dispatcher-type") match {
case Some("fork-join-pool") ⇒ logForkJoinPool(entity.name, snapshot)
case Some("thread-pool-executor") ⇒ logThreadPoolExecutor(entity.name, snapshot)