diff options
author | Ivan Topolnak <ivantopo@gmail.com> | 2013-10-01 19:21:02 -0300 |
---|---|---|
committer | Ivan Topolnak <ivantopo@gmail.com> | 2013-10-01 19:21:02 -0300 |
commit | 65428c248502dadb2bdefa58cbc034ced6af9354 (patch) | |
tree | 05adc56d66a32c0c9b51d40798735023f7d483e2 /kamon-core/src | |
parent | 3919457bc68e203aab27eb9d9a1898fa70225dff (diff) | |
download | Kamon-65428c248502dadb2bdefa58cbc034ced6af9354.tar.gz Kamon-65428c248502dadb2bdefa58cbc034ced6af9354.tar.bz2 Kamon-65428c248502dadb2bdefa58cbc034ced6af9354.zip |
wip
Diffstat (limited to 'kamon-core/src')
-rw-r--r-- | kamon-core/src/main/scala/kamon/TraceContext.scala | 2 | ||||
-rw-r--r-- | kamon-core/src/main/scala/test/PingPong.scala | 31 |
2 files changed, 27 insertions, 6 deletions
diff --git a/kamon-core/src/main/scala/kamon/TraceContext.scala b/kamon-core/src/main/scala/kamon/TraceContext.scala index 23da7001..4ad533fd 100644 --- a/kamon-core/src/main/scala/kamon/TraceContext.scala +++ b/kamon-core/src/main/scala/kamon/TraceContext.scala @@ -22,7 +22,7 @@ object TraceContext { val traceIdCounter = new AtomicLong def apply()(implicit system: ActorSystem) = { - val actor = system.actorOf(UowTraceAggregator.props(reporter, 30 seconds), s"tracer-${traceIdCounter.incrementAndGet()}") + val actor = system.actorOf(UowTraceAggregator.props(reporter, 5 seconds), s"tracer-${traceIdCounter.incrementAndGet()}") actor ! Start() new TraceContext(100, actor) // TODO: Move to a kamon specific supervisor, like /user/kamon/tracer diff --git a/kamon-core/src/main/scala/test/PingPong.scala b/kamon-core/src/main/scala/test/PingPong.scala index c942c6ab..6d8c4636 100644 --- a/kamon-core/src/main/scala/test/PingPong.scala +++ b/kamon-core/src/main/scala/test/PingPong.scala @@ -6,7 +6,7 @@ import kamon.Tracer import spray.routing.SimpleRoutingApp import akka.util.Timeout import spray.httpx.RequestBuilding -import scala.concurrent.Future +import scala.concurrent.{Await, Future} object PingPong extends App { import scala.concurrent.duration._ @@ -72,12 +72,12 @@ object SimpleRequestProcessor extends App with SimpleRoutingApp with RequestBuil pipeline(Get("http://www.despegar.com.ar")).map(r => "Ok") } } ~ - path("reply") { + path("reply" / Segment) { reqID => complete { if (Tracer.context().isEmpty) println("ROUTE NO CONTEXT") - (replier ? "replytome").mapTo[String] + (replier ? reqID).mapTo[String] } } ~ path("ok") { @@ -93,12 +93,33 @@ object SimpleRequestProcessor extends App with SimpleRoutingApp with RequestBuil } +object Verifier extends App with RequestBuilding { + import scala.concurrent.duration._ + import spray.client.pipelining._ + import akka.pattern.ask + + implicit val system = ActorSystem("test") + import system.dispatcher + + implicit val timeout = Timeout(30 seconds) + + val pipeline = sendReceive + + val futures = Future.sequence(for(i <- 1 to 500) yield { + pipeline(Get("http://127.0.0.1/reply/"+i)).map(r => r.entity.asString == i.toString) + }) + Await.result(futures, 10 seconds).forall(_) + + + +} + class Replier extends Actor with ActorLogging { def receive = { - case _ => + case anything => if(Tracer.context.isEmpty) log.warning("PROCESSING A MESSAGE WITHOUT CONTEXT") - sender ! "Ok" + sender ! anything } } |