diff options
author | Diego <diegolparra@gmail.com> | 2016-12-04 15:37:51 -0300 |
---|---|---|
committer | Diego <diegolparra@gmail.com> | 2016-12-04 15:37:51 -0300 |
commit | 56039ef037d42cb817d0bc6d5a5891bc87e633c3 (patch) | |
tree | 711d36b49d69f7321ea75172d9d4969e318d7afe /kamon-core/src/main/scala/kamon/trace/MetricsOnlyContext.scala | |
parent | e02d137ab960676cb89ff597bc33915f8b83a4d2 (diff) | |
download | Kamon-56039ef037d42cb817d0bc6d5a5891bc87e633c3.tar.gz Kamon-56039ef037d42cb817d0bc6d5a5891bc87e633c3.tar.bz2 Kamon-56039ef037d42cb817d0bc6d5a5891bc87e633c3.zip |
wip
Diffstat (limited to 'kamon-core/src/main/scala/kamon/trace/MetricsOnlyContext.scala')
-rw-r--r-- | kamon-core/src/main/scala/kamon/trace/MetricsOnlyContext.scala | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/kamon-core/src/main/scala/kamon/trace/MetricsOnlyContext.scala b/kamon-core/src/main/scala/kamon/trace/MetricsOnlyContext.scala index c1e23d91..bc0bedba 100644 --- a/kamon-core/src/main/scala/kamon/trace/MetricsOnlyContext.scala +++ b/kamon-core/src/main/scala/kamon/trace/MetricsOnlyContext.scala @@ -20,19 +20,21 @@ import java.util.concurrent.ConcurrentLinkedQueue import akka.event.LoggingAdapter import kamon.Kamon -import kamon.metric.{ SegmentMetrics, TraceMetrics } -import kamon.util.{ NanoInterval, RelativeNanoTimestamp } +import kamon.metric.{SegmentMetrics, TraceMetrics} +import kamon.util.{NanoInterval, RelativeNanoTimestamp} import scala.annotation.tailrec import scala.collection.concurrent.TrieMap -private[kamon] class MetricsOnlyContext(traceName: String, +private[kamon] class MetricsOnlyContext( + traceName: String, val token: String, traceTags: Map[String, String], currentStatus: Status, val levelOfDetail: LevelOfDetail, val startTimestamp: RelativeNanoTimestamp, - log: LoggingAdapter) extends TraceContext { + log: LoggingAdapter +) extends TraceContext { @volatile private var _name = traceName @volatile private var _status = currentStatus @@ -86,9 +88,10 @@ private[kamon] class MetricsOnlyContext(traceName: String, val segment = _finishedSegments.poll() if (segment != null) { val defaultTags = Map( - "trace" -> name, - "category" -> segment.category, - "library" -> segment.library) + "trace" → name, + "category" → segment.category, + "library" → segment.library + ) if (Kamon.metrics.shouldTrack(segment.name, SegmentMetrics.category)) { val segmentEntity = Kamon.metrics.entity(SegmentMetrics, segment.name, defaultTags ++ segment.tags) @@ -99,12 +102,14 @@ private[kamon] class MetricsOnlyContext(traceName: String, } } - protected def finishSegment(segmentName: String, + protected def finishSegment( + segmentName: String, category: String, library: String, duration: NanoInterval, segmentTags: Map[String, String], - isFinishedWithError: Boolean): Unit = { + isFinishedWithError: Boolean + ): Unit = { _finishedSegments.add(SegmentLatencyData(segmentName, category, library, duration, segmentTags, isFinishedWithError)) @@ -120,10 +125,12 @@ private[kamon] class MetricsOnlyContext(traceName: String, // will be returned. def elapsedTime: NanoInterval = _elapsedTime - class MetricsOnlySegment(segmentName: String, + class MetricsOnlySegment( + segmentName: String, val category: String, val library: String, - segmentTags: Map[String, String]) extends Segment { + segmentTags: Map[String, String] + ) extends Segment { private val _startTimestamp = RelativeNanoTimestamp.now private val _tags = TrieMap.empty[String, String] ++= segmentTags @@ -169,9 +176,11 @@ private[kamon] class MetricsOnlyContext(traceName: String, } } -case class SegmentLatencyData(name: String, +case class SegmentLatencyData( + name: String, category: String, library: String, duration: NanoInterval, tags: Map[String, String], - isFinishedWithError: Boolean)
\ No newline at end of file + isFinishedWithError: Boolean +)
\ No newline at end of file |