From 7a10c0ef2a6566229e8571f6d385ca2ff794cc20 Mon Sep 17 00:00:00 2001 From: Ivan Topolnak Date: Thu, 2 Jan 2014 18:09:53 -0300 Subject: integrate trace and metrics into the base project --- kamon-playground/src/main/resources/application.conf | 14 +++++++++++++- kamon-playground/src/main/resources/logback.xml | 3 ++- .../src/main/scala/test/SimpleRequestProcessor.scala | 12 +++++++++--- 3 files changed, 24 insertions(+), 5 deletions(-) (limited to 'kamon-playground/src') diff --git a/kamon-playground/src/main/resources/application.conf b/kamon-playground/src/main/resources/application.conf index 88fe8e8d..88a77566 100644 --- a/kamon-playground/src/main/resources/application.conf +++ b/kamon-playground/src/main/resources/application.conf @@ -1,9 +1,21 @@ akka { loggers = [ "akka.event.slf4j.Slf4jLogger" ] - loglevel = DEBUG + loglevel = INFO actor { debug { unhandled = on } } +} + + +kamon { + metrics { + actors { + tracked = [ + "user/simple-service-actor", + "other" + ] + } + } } \ No newline at end of file diff --git a/kamon-playground/src/main/resources/logback.xml b/kamon-playground/src/main/resources/logback.xml index 2ae1e3bd..e948eaf5 100644 --- a/kamon-playground/src/main/resources/logback.xml +++ b/kamon-playground/src/main/resources/logback.xml @@ -1,7 +1,8 @@ + - %date{HH:mm:ss.SSS} %-5level [%X{uow}][%X{requestId}] [%thread] %logger{55} - %msg%n + %date{HH:mm:ss.SSS} %-5level [%uow][%X{akkaSource}] [%thread] %logger{55} - %msg%n diff --git a/kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala b/kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala index 333f5031..868a1921 100644 --- a/kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala +++ b/kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala @@ -24,6 +24,7 @@ import kamon.spray.UowDirectives import kamon.trace.Trace import kamon.Kamon import scala.util.Random +import akka.routing.RoundRobinRouter object SimpleRequestProcessor extends App with SimpleRoutingApp with RequestBuilding with UowDirectives { import scala.concurrent.duration._ @@ -34,7 +35,6 @@ object SimpleRequestProcessor extends App with SimpleRoutingApp with RequestBuil import system.dispatcher val act = system.actorOf(Props(new Actor { - println("Initializing from: " + (new Throwable).getStackTraceString) def receive: Actor.Receive = { case any ⇒ sender ! any } }), "com") @@ -43,7 +43,7 @@ object SimpleRequestProcessor extends App with SimpleRoutingApp with RequestBuil implicit val timeout = Timeout(30 seconds) val pipeline = sendReceive - val replier = system.actorOf(Props[Replier]) + val replier = system.actorOf(Props[Replier].withRouter(RoundRobinRouter(nrOfInstances = 2)), "replier") val random = new Random() startServer(interface = "localhost", port = 9090) { get { @@ -83,6 +83,12 @@ object SimpleRequestProcessor extends App with SimpleRoutingApp with RequestBuil complete(Future { "OK" }) } } ~ + path("kill") { + dynamic { + replier ! PoisonPill + complete(Future { "OK" }) + } + } ~ path("error") { complete { throw new NullPointerException @@ -121,7 +127,7 @@ class Replier extends Actor with ActorLogging { if (Trace.context.isEmpty) log.warning("PROCESSING A MESSAGE WITHOUT CONTEXT") - log.info("Processing at the Replier") + log.info("Processing at the Replier, and self is: {}", self) sender ! anything } } -- cgit v1.2.3