diff options
Diffstat (limited to 'kamon-trace/src/main/scala/kamon/trace/Trace.scala')
-rw-r--r-- | kamon-trace/src/main/scala/kamon/trace/Trace.scala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/kamon-trace/src/main/scala/kamon/trace/Trace.scala b/kamon-trace/src/main/scala/kamon/trace/Trace.scala index 05519067..6eff69e5 100644 --- a/kamon-trace/src/main/scala/kamon/trace/Trace.scala +++ b/kamon-trace/src/main/scala/kamon/trace/Trace.scala @@ -60,6 +60,23 @@ 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") + } + } } class TraceExtension(system: ExtendedActorSystem) extends Kamon.Extension { |