diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2016-03-15 23:31:11 +0100 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2016-03-15 23:31:11 +0100 |
commit | 60880bb1b6ec15f40ecacf5ab46c849a86ce4b60 (patch) | |
tree | 0fe880c75b891b99f3503d876b3f7e98de11a67b /kamon-akka/src/main/scala/kamon/akka/instrumentation/EnvelopeInstrumentation.scala | |
parent | cf45b7bcac148945ff209fd7abefc761d916be9a (diff) | |
parent | 9e52aad6b02da72ca28d52d0c94e2e8784e7aa65 (diff) | |
download | Kamon-60880bb1b6ec15f40ecacf5ab46c849a86ce4b60.tar.gz Kamon-60880bb1b6ec15f40ecacf5ab46c849a86ce4b60.tar.bz2 Kamon-60880bb1b6ec15f40ecacf5ab46c849a86ce4b60.zip |
Merge branch 'issue#271/fix-balancing-pool-metrics'
Diffstat (limited to 'kamon-akka/src/main/scala/kamon/akka/instrumentation/EnvelopeInstrumentation.scala')
-rw-r--r-- | kamon-akka/src/main/scala/kamon/akka/instrumentation/EnvelopeInstrumentation.scala | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/kamon-akka/src/main/scala/kamon/akka/instrumentation/EnvelopeInstrumentation.scala b/kamon-akka/src/main/scala/kamon/akka/instrumentation/EnvelopeInstrumentation.scala new file mode 100644 index 00000000..0bb50dc2 --- /dev/null +++ b/kamon-akka/src/main/scala/kamon/akka/instrumentation/EnvelopeInstrumentation.scala @@ -0,0 +1,32 @@ +package akka.kamon.instrumentation + +import kamon.trace.{ EmptyTraceContext, TraceContext } +import kamon.util.RelativeNanoTimestamp +import org.aspectj.lang.annotation.{ DeclareMixin, Aspect } + +case class EnvelopeContext(nanoTime: RelativeNanoTimestamp, context: TraceContext) + +object EnvelopeContext { + val Empty = EnvelopeContext(RelativeNanoTimestamp.zero, EmptyTraceContext) +} + +trait InstrumentedEnvelope { + def envelopeContext(): EnvelopeContext + def setEnvelopeContext(envelopeContext: EnvelopeContext): Unit +} + +object InstrumentedEnvelope { + def apply(): InstrumentedEnvelope = new InstrumentedEnvelope { + var envelopeContext: EnvelopeContext = _ + + def setEnvelopeContext(envelopeContext: EnvelopeContext): Unit = + this.envelopeContext = envelopeContext + } +} + +@Aspect +class EnvelopeContextIntoEnvelopeMixin { + + @DeclareMixin("akka.dispatch.Envelope") + def mixinInstrumentationToEnvelope: InstrumentedEnvelope = InstrumentedEnvelope() +}
\ No newline at end of file |