diff options
Diffstat (limited to 'kamon-core/src/main/scala/kamon/trace')
-rw-r--r-- | kamon-core/src/main/scala/kamon/trace/ActiveSpan.scala | 3 | ||||
-rw-r--r-- | kamon-core/src/main/scala/kamon/trace/Span.scala | 16 |
2 files changed, 14 insertions, 5 deletions
diff --git a/kamon-core/src/main/scala/kamon/trace/ActiveSpan.scala b/kamon-core/src/main/scala/kamon/trace/ActiveSpan.scala index c30a7157..b6e5d5e9 100644 --- a/kamon-core/src/main/scala/kamon/trace/ActiveSpan.scala +++ b/kamon-core/src/main/scala/kamon/trace/ActiveSpan.scala @@ -66,6 +66,9 @@ object ActiveSpan { override def capture(): Continuation = wrappedSpan.capture() + + override def capture(activeSpanSource: ActiveSpanSource): Continuation = + wrappedSpan.capture(activeSpanSource) } object Default { diff --git a/kamon-core/src/main/scala/kamon/trace/Span.scala b/kamon-core/src/main/scala/kamon/trace/Span.scala index 01cfbfc3..113ec3de 100644 --- a/kamon-core/src/main/scala/kamon/trace/Span.scala +++ b/kamon-core/src/main/scala/kamon/trace/Span.scala @@ -16,9 +16,9 @@ package kamon package trace +import kamon.ReporterRegistry.SpanSink import kamon.trace.SpanContext.SamplingDecision -import scala.collection.JavaConverters._ import kamon.util.{Clock, MeasurementUnit} /** @@ -31,6 +31,8 @@ trait BaseSpan { def capture(): Continuation + def capture(activeSpanSource: ActiveSpanSource): Continuation + def annotate(annotation: Span.Annotation): Span def addSpanTag(key: String, value: String): Span @@ -76,6 +78,7 @@ object Span { final class Empty(activeSpanSource: ActiveSpanSource) extends Span { override val context: SpanContext = SpanContext.EmptySpanContext override def capture(): Continuation = Continuation.Default(this, activeSpanSource) + override def capture(activeSpanSource: ActiveSpanSource): Continuation = Continuation.Default(this, activeSpanSource) override def annotate(annotation: Annotation): Span = this override def addSpanTag(key: String, value: String): Span = this @@ -99,10 +102,10 @@ object Span { * @param initialOperationName * @param initialSpanTags * @param startTimestampMicros - * @param reporterRegistry + * @param spanSink */ final class Real(spanContext: SpanContext, initialOperationName: String, initialSpanTags: Map[String, Span.TagValue], - initialMetricTags: Map[String, String], startTimestampMicros: Long, reporterRegistry: ReporterRegistryImpl, tracer: Tracer) extends Span { + initialMetricTags: Map[String, String], startTimestampMicros: Long, spanSink: SpanSink, activeSpanSource: ActiveSpanSource) extends Span { private var collectMetrics: Boolean = true private var open: Boolean = true @@ -175,12 +178,15 @@ object Span { recordSpanMetrics(finishMicros) if(sampled) - reporterRegistry.reportSpan(toFinishedSpan(finishMicros)) + spanSink.reportSpan(toFinishedSpan(finishMicros)) } } override def capture(): Continuation = - Continuation.Default(this, tracer) + Continuation.Default(this, activeSpanSource) + + override def capture(activeSpanSource: ActiveSpanSource): Continuation = + Continuation.Default(this, activeSpanSource) private def toFinishedSpan(endTimestampMicros: Long): Span.FinishedSpan = Span.FinishedSpan(spanContext, operationName, startTimestampMicros, endTimestampMicros, spanTags, annotations) |