diff options
Diffstat (limited to 'kamon-core/src/main/scala/kamon/util/Mixin.scala')
-rw-r--r-- | kamon-core/src/main/scala/kamon/util/Mixin.scala | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kamon-core/src/main/scala/kamon/util/Mixin.scala b/kamon-core/src/main/scala/kamon/util/Mixin.scala index f214e875..348b34f1 100644 --- a/kamon-core/src/main/scala/kamon/util/Mixin.scala +++ b/kamon-core/src/main/scala/kamon/util/Mixin.scala @@ -32,12 +32,14 @@ object HasContinuation { /** * Construct a HasContinuation instance by capturing a continuation from the provided active span. */ - def from(activeSpan: ActiveSpan): HasContinuation = - new Default(activeSpan.capture()) + def from(activeSpan: ActiveSpan): HasContinuation = { + val continuation = if(activeSpan == null) null else activeSpan.capture() + new Default(continuation) + } /** * Constructs a new HasContinuation instance using Kamon's tracer currently active span. */ def fromTracerActiveSpan(): HasContinuation = - new Default(Kamon.activeSpan().capture()) + new Default(Kamon.activeSpanContinuation()) } |