diff options
Diffstat (limited to 'kamon-core/src/main/scala/kamon/TraceContextSwap.scala')
-rw-r--r-- | kamon-core/src/main/scala/kamon/TraceContextSwap.scala | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/kamon-core/src/main/scala/kamon/TraceContextSwap.scala b/kamon-core/src/main/scala/kamon/TraceContextSwap.scala deleted file mode 100644 index 470b2f34..00000000 --- a/kamon-core/src/main/scala/kamon/TraceContextSwap.scala +++ /dev/null @@ -1,34 +0,0 @@ -package kamon - -import org.slf4j.MDC - -/** - * Provides support for making a TraceContext available as ThreadLocal and cleanning up afterwards. - */ -trait TraceContextSwap { - - def withContext[A](ctx: Option[TraceContext], body: => A): A = withContext(ctx, body, body) - - def withContext[A](ctx: Option[TraceContext], primary: => A, fallback: => A): A = { - - val previous = Tracer.context() - val r = ctx match { - case Some(context) => { - //MDC.put("uow", context.userContext.get.asInstanceOf[String]) - Tracer.set(context) - val bodyResult = primary - //Tracer.clear - //MDC.remove("uow") - - bodyResult - } - case None => fallback - } - previous.map(ctx => Tracer.set(ctx)) - - r - } - -} - -object TraceContextSwap extends TraceContextSwap |