diff options
Diffstat (limited to 'src/main/scala/kamon/Kamon.scala')
-rw-r--r-- | src/main/scala/kamon/Kamon.scala | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/main/scala/kamon/Kamon.scala b/src/main/scala/kamon/Kamon.scala new file mode 100644 index 00000000..b5998f81 --- /dev/null +++ b/src/main/scala/kamon/Kamon.scala @@ -0,0 +1,26 @@ +package kamon + +import akka.actor.{Props, ActorSystem} + +object Kamon { + + implicit val actorSystem = ActorSystem("kamon") + + private val ctx = new ThreadLocal[Option[TraceContext]] { + override def initialValue() = None + } + + def context = ctx.get() + def clear = ctx.remove() + def set(traceContext: TraceContext) = ctx.set(Some(traceContext)) + + def start: Unit = set(newTraceContext) + + def newTraceContext(): TraceContext = TraceContext() + + + val publisher = actorSystem.actorOf(Props[TransactionPublisher]) + + def publish(tx: FullTransaction) = publisher ! tx + +} |