aboutsummaryrefslogtreecommitdiff
path: root/kamon-spray/src/main
diff options
context:
space:
mode:
authorIvan Topolnjak <ivantopo@gmail.com>2014-10-25 04:45:21 +0200
committerIvan Topolnjak <ivantopo@gmail.com>2014-10-25 04:46:59 +0200
commitea1a0d5d76988992227eb30b0baaf8e97678c946 (patch)
tree8a6e7be43510595a6059a34c921c06c5161c7107 /kamon-spray/src/main
parent3e2c2b3ba39ad8cca4874e3be3004f8a182dab36 (diff)
downloadKamon-ea1a0d5d76988992227eb30b0baaf8e97678c946.tar.gz
Kamon-ea1a0d5d76988992227eb30b0baaf8e97678c946.tar.bz2
Kamon-ea1a0d5d76988992227eb30b0baaf8e97678c946.zip
! core: replace Option[TraceContext] by empty object pattern and implement basic segments with renaming.
Diffstat (limited to 'kamon-spray/src/main')
-rw-r--r--kamon-spray/src/main/scala/spray/can/client/ClientRequestInstrumentation.scala18
1 files changed, 9 insertions, 9 deletions
diff --git a/kamon-spray/src/main/scala/spray/can/client/ClientRequestInstrumentation.scala b/kamon-spray/src/main/scala/spray/can/client/ClientRequestInstrumentation.scala
index df1d2b59..d9cdde08 100644
--- a/kamon-spray/src/main/scala/spray/can/client/ClientRequestInstrumentation.scala
+++ b/kamon-spray/src/main/scala/spray/can/client/ClientRequestInstrumentation.scala
@@ -20,7 +20,7 @@ import org.aspectj.lang.annotation._
import org.aspectj.lang.ProceedingJoinPoint
import spray.http.{ HttpHeader, HttpResponse, HttpMessageEnd, HttpRequest }
import spray.http.HttpHeaders.{ RawHeader, Host }
-import kamon.trace.{ TraceRecorder, SegmentCompletionHandleAware }
+import kamon.trace.{SegmentAware, TraceRecorder, SegmentCompletionHandleAware}
import kamon.metric.TraceMetrics.HttpClientRequest
import kamon.Kamon
import kamon.spray.{ ClientSegmentCollectionStrategy, Spray }
@@ -32,13 +32,13 @@ import akka.util.Timeout
class ClientRequestInstrumentation {
@DeclareMixin("spray.can.client.HttpHostConnector.RequestContext")
- def mixin: SegmentCompletionHandleAware = SegmentCompletionHandleAware.default
+ def mixin: SegmentAware = SegmentAware.default
@Pointcut("execution(spray.can.client.HttpHostConnector.RequestContext.new(..)) && this(ctx) && args(request, *, *, *)")
- def requestContextCreation(ctx: SegmentCompletionHandleAware, request: HttpRequest): Unit = {}
+ def requestContextCreation(ctx: SegmentAware, request: HttpRequest): Unit = {}
@After("requestContextCreation(ctx, request)")
- def afterRequestContextCreation(ctx: SegmentCompletionHandleAware, request: HttpRequest): Unit = {
+ def afterRequestContextCreation(ctx: SegmentAware, request: HttpRequest): Unit = {
// The RequestContext will be copied when a request needs to be retried but we are only interested in creating the
// completion handle the first time we create one.
@@ -59,25 +59,25 @@ class ClientRequestInstrumentation {
}
@Pointcut("execution(* spray.can.client.HttpHostConnector.RequestContext.copy(..)) && this(old)")
- def copyingRequestContext(old: SegmentCompletionHandleAware): Unit = {}
+ def copyingRequestContext(old: SegmentAware): Unit = {}
@Around("copyingRequestContext(old)")
- def aroundCopyingRequestContext(pjp: ProceedingJoinPoint, old: SegmentCompletionHandleAware): Any = {
+ def aroundCopyingRequestContext(pjp: ProceedingJoinPoint, old: SegmentAware): Any = {
TraceRecorder.withInlineTraceContextReplacement(old.traceContext) {
pjp.proceed()
}
}
@Pointcut("execution(* spray.can.client.HttpHostConnectionSlot.dispatchToCommander(..)) && args(requestContext, message)")
- def dispatchToCommander(requestContext: SegmentCompletionHandleAware, message: Any): Unit = {}
+ def dispatchToCommander(requestContext: SegmentAware, message: Any): Unit = {}
@Around("dispatchToCommander(requestContext, message)")
- def aroundDispatchToCommander(pjp: ProceedingJoinPoint, requestContext: SegmentCompletionHandleAware, message: Any) = {
+ def aroundDispatchToCommander(pjp: ProceedingJoinPoint, requestContext: SegmentAware, message: Any) = {
requestContext.traceContext match {
case ctx @ Some(_) ⇒
TraceRecorder.withInlineTraceContextReplacement(ctx) {
if (message.isInstanceOf[HttpMessageEnd])
- requestContext.segmentCompletionHandle.map(_.finish(Map.empty))
+ requestContext.segment.finish()
pjp.proceed()
}