diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2013-11-29 09:59:37 -0300 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2013-11-29 09:59:37 -0300 |
commit | 231b5b0fc61438ec96e309436295e86808abdbb5 (patch) | |
tree | 10288215da3562b5d523b4d2d97b703056cfe4fa /kamon-trace | |
parent | b80e4bd135ed50b01def5a4c2f7c42983efb54fd (diff) | |
download | Kamon-231b5b0fc61438ec96e309436295e86808abdbb5.tar.gz Kamon-231b5b0fc61438ec96e309436295e86808abdbb5.tar.bz2 Kamon-231b5b0fc61438ec96e309436295e86808abdbb5.zip |
instrumentation is back in place
Diffstat (limited to 'kamon-trace')
-rw-r--r-- | kamon-trace/src/main/scala/kamon/trace/Segments.scala | 11 | ||||
-rw-r--r-- | kamon-trace/src/main/scala/kamon/trace/Trace.scala | 9 |
2 files changed, 20 insertions, 0 deletions
diff --git a/kamon-trace/src/main/scala/kamon/trace/Segments.scala b/kamon-trace/src/main/scala/kamon/trace/Segments.scala index 0e1778bf..7cc20181 100644 --- a/kamon-trace/src/main/scala/kamon/trace/Segments.scala +++ b/kamon-trace/src/main/scala/kamon/trace/Segments.scala @@ -16,6 +16,8 @@ package kamon.trace +import kamon.trace.Trace.SegmentCompletionHandle + object Segments { trait Category @@ -27,4 +29,13 @@ object Segments { case class End(attributes: Map[String, String] = Map(), timestamp: Long = System.nanoTime()) case class Segment(start: Start, end: End) + + + + + trait SegmentCompletionHandleAware { + var completionHandle: Option[SegmentCompletionHandle] + } + + trait ContextAndSegmentCompletionAware extends ContextAware with SegmentCompletionHandleAware } diff --git a/kamon-trace/src/main/scala/kamon/trace/Trace.scala b/kamon-trace/src/main/scala/kamon/trace/Trace.scala index 02947dd6..6eff69e5 100644 --- a/kamon-trace/src/main/scala/kamon/trace/Trace.scala +++ b/kamon-trace/src/main/scala/kamon/trace/Trace.scala @@ -61,9 +61,18 @@ object Trace extends ExtensionId[TraceExtension] with ExtensionIdProvider { // TODO: FIX def newTraceContext(name: String)(implicit system: ActorSystem): TraceContext = TraceContext(Kamon(Trace), tranid.getAndIncrement, name) + def startSegment(category: Segments.Category, description: String = "", attributes: Map[String, String] = Map()): SegmentCompletionHandle = { + val start = Segments.Start(category, description, attributes) + SegmentCompletionHandle(start) + } + def startSegment(start: Segments.Start): SegmentCompletionHandle = SegmentCompletionHandle(start) case class SegmentCompletionHandle(start: Segments.Start) { + def complete(): Unit = { + val end = Segments.End() + println(s"Completing the Segment: $start - $end") + } def complete(end: Segments.End): Unit = { println(s"Completing the Segment: $start - $end") } |