diff options
Diffstat (limited to 'kamon-core/src/main')
-rw-r--r-- | kamon-core/src/main/scala/kamon/instrumentation/akka/ActorCellInstrumentation.scala | 8 | ||||
-rw-r--r-- | kamon-core/src/main/scala/kamon/trace/TraceContext.scala | 16 |
2 files changed, 16 insertions, 8 deletions
diff --git a/kamon-core/src/main/scala/kamon/instrumentation/akka/ActorCellInstrumentation.scala b/kamon-core/src/main/scala/kamon/instrumentation/akka/ActorCellInstrumentation.scala index 9b541a32..90928ba0 100644 --- a/kamon-core/src/main/scala/kamon/instrumentation/akka/ActorCellInstrumentation.scala +++ b/kamon-core/src/main/scala/kamon/instrumentation/akka/ActorCellInstrumentation.scala @@ -59,7 +59,7 @@ class ActorCellInstrumentation { def aroundBehaviourInvoke(pjp: ProceedingJoinPoint, cell: ActorCell, envelope: Envelope): Any = { val cellWithMetrics = cell.asInstanceOf[ActorCellMetrics] val timestampBeforeProcessing = System.nanoTime() - val contextAndTimestamp = envelope.asInstanceOf[TraceContextAware] + val contextAndTimestamp = envelope.asInstanceOf[TimestampedTraceContextAware] try { TraceRecorder.withInlineTraceContextReplacement(contextAndTimestamp.traceContext) { @@ -154,13 +154,13 @@ class ActorCellMetricsIntoActorCellMixin { class TraceContextIntoEnvelopeMixin { @DeclareMixin("akka.dispatch.Envelope") - def mixinTraceContextAwareToEnvelope: TraceContextAware = TraceContextAware.default + def mixinTraceContextAwareToEnvelope: TimestampedTraceContextAware = TimestampedTraceContextAware.default @Pointcut("execution(akka.dispatch.Envelope.new(..)) && this(ctx)") - def envelopeCreation(ctx: TraceContextAware): Unit = {} + def envelopeCreation(ctx: TimestampedTraceContextAware): Unit = {} @After("envelopeCreation(ctx)") - def afterEnvelopeCreation(ctx: TraceContextAware): Unit = { + def afterEnvelopeCreation(ctx: TimestampedTraceContextAware): Unit = { // Necessary to force the initialization of ContextAware at the moment of creation. ctx.traceContext } diff --git a/kamon-core/src/main/scala/kamon/trace/TraceContext.scala b/kamon-core/src/main/scala/kamon/trace/TraceContext.scala index 08289acf..c4c28a68 100644 --- a/kamon-core/src/main/scala/kamon/trace/TraceContext.scala +++ b/kamon-core/src/main/scala/kamon/trace/TraceContext.scala @@ -129,7 +129,7 @@ class DefaultTraceContext(traceName: String, val token: String, izOpen: Boolean, def finish: Unit = { val segmentFinishNanoTime = System.nanoTime() - finishSegment(segmentName, label, (segmentFinishNanoTime - _segmentStartNanoTime)) + finishSegment(name, label, (segmentFinishNanoTime - _segmentStartNanoTime)) } } } @@ -155,7 +155,6 @@ object TraceContextOrigin { } trait TraceContextAware extends Serializable { - def captureNanoTime: Long def traceContext: TraceContext } @@ -163,7 +162,6 @@ object TraceContextAware { def default: TraceContextAware = new DefaultTraceContextAware class DefaultTraceContextAware extends TraceContextAware { - @transient val captureNanoTime = System.nanoTime() @transient val traceContext = TraceRecorder.currentContext // @@ -180,7 +178,17 @@ object TraceContextAware { } } -trait SegmentAware extends TraceContextAware { +trait TimestampedTraceContextAware extends TraceContextAware { + def captureNanoTime: Long +} + +object TimestampedTraceContextAware { + def default: TimestampedTraceContextAware = new DefaultTraceContextAware with TimestampedTraceContextAware { + @transient val captureNanoTime = System.nanoTime() + } +} + +trait SegmentAware { @volatile var segment: Segment = EmptyTraceContext.EmptySegment } |