diff options
author | Ivan Topolnak <ivantopo@gmail.com> | 2013-11-04 18:11:16 -0300 |
---|---|---|
committer | Ivan Topolnak <ivantopo@gmail.com> | 2013-11-04 18:11:16 -0300 |
commit | 5127c3bb83cd6fe90e071720d995cfb53d913e6a (patch) | |
tree | a29cc7be7f729566f3a5a2fc3bc8044c7f47f3cc /kamon-trace/src/main/scala/kamon/trace/Tracer.scala | |
parent | ca1e93621ddad4b9f2a9028ea183b1c2f4c25a27 (diff) | |
download | Kamon-5127c3bb83cd6fe90e071720d995cfb53d913e6a.tar.gz Kamon-5127c3bb83cd6fe90e071720d995cfb53d913e6a.tar.bz2 Kamon-5127c3bb83cd6fe90e071720d995cfb53d913e6a.zip |
wip
Diffstat (limited to 'kamon-trace/src/main/scala/kamon/trace/Tracer.scala')
-rw-r--r-- | kamon-trace/src/main/scala/kamon/trace/Tracer.scala | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/kamon-trace/src/main/scala/kamon/trace/Tracer.scala b/kamon-trace/src/main/scala/kamon/trace/Tracer.scala index e64cfaa6..4ea89850 100644 --- a/kamon-trace/src/main/scala/kamon/trace/Tracer.scala +++ b/kamon-trace/src/main/scala/kamon/trace/Tracer.scala @@ -1,7 +1,40 @@ package kamon.trace +import kamon.Kamon import scala.util.DynamicVariable +import akka.actor._ +import scala.Some +import kamon.trace.Trace.Register +import scala.concurrent.duration._ +object Trace extends ExtensionId[TraceExtension] with ExtensionIdProvider { + def lookup(): ExtensionId[_ <: Extension] = Trace + def createExtension(system: ExtendedActorSystem): TraceExtension = new TraceExtension(system) + + + /*** Protocol */ + case object Register +} + +class TraceExtension(system: ExtendedActorSystem) extends Kamon.Extension { + def manager: ActorRef = ??? +} + +class TraceManager extends Actor { + var listeners: Seq[ActorRef] = Seq.empty + + def receive = { + case Register => listeners = sender +: listeners + case segment: UowSegment => + context.child(segment.id.toString) match { + case Some(agreggator) => agreggator ! segment + case None => context.actorOf(UowTraceAggregator.props(self, 30 seconds)) + } + + case trace: UowTrace => + listeners foreach(_ ! trace) + } +} object Tracer { |