diff options
author | Diego Parra <diegolparra@gmail.com> | 2016-07-08 11:10:09 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-08 11:10:09 -0300 |
commit | ef927dc672bea427d4de89b8d0ea0bd18bd71285 (patch) | |
tree | b70c59924450fab5b5cb03e6255afef0af7604d5 /kamon-core/src/main/scala/kamon/trace/TracingContext.scala | |
parent | ebc560f24154ddec862411b82a79033164bb2c31 (diff) | |
download | Kamon-ef927dc672bea427d4de89b8d0ea0bd18bd71285.tar.gz Kamon-ef927dc672bea427d4de89b8d0ea0bd18bd71285.tar.bz2 Kamon-ef927dc672bea427d4de89b8d0ea0bd18bd71285.zip |
+ Kamon-core: introduce finishWithError(Throwable) for Traces and Segments
* + kamon-core: introduce finishWithError(Throwable) for Traces and Segments
Diffstat (limited to 'kamon-core/src/main/scala/kamon/trace/TracingContext.scala')
-rw-r--r-- | kamon-core/src/main/scala/kamon/trace/TracingContext.scala | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/kamon-core/src/main/scala/kamon/trace/TracingContext.scala b/kamon-core/src/main/scala/kamon/trace/TracingContext.scala index 085b4b09..496d7317 100644 --- a/kamon-core/src/main/scala/kamon/trace/TracingContext.scala +++ b/kamon-core/src/main/scala/kamon/trace/TracingContext.scala @@ -20,13 +20,14 @@ import java.util.concurrent.ConcurrentLinkedQueue import java.util.concurrent.atomic.AtomicInteger import akka.event.LoggingAdapter +import kamon.trace.States.Status import kamon.util.{ NanoInterval, NanoTimestamp, RelativeNanoTimestamp } import scala.collection.concurrent.TrieMap -private[trace] class TracingContext(traceName: String, token: String, tags: Map[String, String], izOpen: Boolean, levelOfDetail: LevelOfDetail, +private[trace] class TracingContext(traceName: String, token: String, tags: Map[String, String], currentStatus: Status, levelOfDetail: LevelOfDetail, isLocal: Boolean, startTimeztamp: RelativeNanoTimestamp, log: LoggingAdapter, traceInfoSink: TracingContext ⇒ Unit) - extends MetricsOnlyContext(traceName, token, tags, izOpen, levelOfDetail, startTimeztamp, log) { + extends MetricsOnlyContext(traceName, token, tags, currentStatus, levelOfDetail, startTimeztamp, log) { private val _openSegments = new AtomicInteger(0) private val _startTimestamp = NanoTimestamp.now @@ -51,12 +52,12 @@ private[trace] class TracingContext(traceName: String, token: String, tags: Map[ traceInfoSink(this) } - override def finishSegment(segmentName: String, category: String, library: String, duration: NanoInterval, tags: Map[String, String]): Unit = { + override def finishSegment(segmentName: String, category: String, library: String, duration: NanoInterval, tags: Map[String, String], isFinishedWithError: Boolean = false): Unit = { _openSegments.decrementAndGet() - super.finishSegment(segmentName, category, library, duration, tags) + super.finishSegment(segmentName, category, library, duration, tags, isFinishedWithError) } - def shouldIncubate: Boolean = isOpen || _openSegments.get() > 0 + def shouldIncubate: Boolean = (States.Open == status) || _openSegments.get() > 0 // Handle with care, should only be used after a trace is finished. def generateTraceInfo: TraceInfo = { |