diff options
Diffstat (limited to 'kamon-spray/src')
-rw-r--r-- | kamon-spray/src/main/scala/kamon/spray/instrumentation/ServerRequestInstrumentation.scala | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/kamon-spray/src/main/scala/kamon/spray/instrumentation/ServerRequestInstrumentation.scala b/kamon-spray/src/main/scala/kamon/spray/instrumentation/ServerRequestInstrumentation.scala index d76b9f58..d773ecd8 100644 --- a/kamon-spray/src/main/scala/kamon/spray/instrumentation/ServerRequestInstrumentation.scala +++ b/kamon-spray/src/main/scala/kamon/spray/instrumentation/ServerRequestInstrumentation.scala @@ -15,10 +15,8 @@ * ========================================================== */ package spray.can.server.instrumentation -import kamon.trace.TraceLocal.{ HttpContext, HttpContextKey } import org.aspectj.lang.annotation._ import kamon.trace._ -import spray.can.server.OpenRequest import spray.http.{ HttpResponse, HttpMessagePartWrapper, HttpRequest } import kamon.Kamon import kamon.spray.{ SprayExtension, Spray } @@ -28,8 +26,6 @@ import spray.http.HttpHeaders.RawHeader @Aspect class ServerRequestInstrumentation { - import ServerRequestInstrumentation._ - @DeclareMixin("spray.can.server.OpenRequestComponent.DefaultOpenRequest") def mixinContextAwareToOpenRequest: TraceContextAware = TraceContextAware.default @@ -87,9 +83,6 @@ class ServerRequestInstrumentation { recordHttpServerMetrics(response, incomingContext.name, sprayExtension) - //store in TraceLocal useful data to diagnose errors - storeDiagnosticData(openRequest) - proceedResult } } @@ -116,19 +109,4 @@ class ServerRequestInstrumentation { case response: HttpResponse ⇒ response.withHeaders(response.headers ::: RawHeader(traceTokenHeaderName, token) :: Nil) case other ⇒ other } - - def storeDiagnosticData(currentContext: TraceContextAware): Unit = { - val request = currentContext.asInstanceOf[OpenRequest].request - val headers = request.headers.map(header ⇒ header.name -> header.value).toMap - val agent = headers.getOrElse(UserAgent, Unknown) - val forwarded = headers.getOrElse(XForwardedFor, Unknown) - - TraceLocal.store(HttpContextKey)(HttpContext(agent, request.uri.toRelative.toString(), forwarded)) - } -} - -object ServerRequestInstrumentation { - val UserAgent = "User-Agent" - val XForwardedFor = "X-Forwarded-For" - val Unknown = "unknown" } |