diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2015-08-30 13:36:27 +0200 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2015-08-30 13:36:27 +0200 |
commit | 539b54c3b43c68ad418ca77032f557a4da3e3a59 (patch) | |
tree | 8f7a5f7528bc6fc16afb0351661e1d4b5687f41a /kamon-play-2.3.x/src/main/scala/kamon/play/Play.scala | |
parent | 110fff9745a0c1f154ee3d7a5149cd9f162a879f (diff) | |
download | Kamon-539b54c3b43c68ad418ca77032f557a4da3e3a59.tar.gz Kamon-539b54c3b43c68ad418ca77032f557a4da3e3a59.tar.bz2 Kamon-539b54c3b43c68ad418ca77032f557a4da3e3a59.zip |
wip: only the modules that actually require an actor system are getting one.
Diffstat (limited to 'kamon-play-2.3.x/src/main/scala/kamon/play/Play.scala')
-rw-r--r-- | kamon-play-2.3.x/src/main/scala/kamon/play/Play.scala | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/kamon-play-2.3.x/src/main/scala/kamon/play/Play.scala b/kamon-play-2.3.x/src/main/scala/kamon/play/Play.scala index d8ef5c97..0da52283 100644 --- a/kamon-play-2.3.x/src/main/scala/kamon/play/Play.scala +++ b/kamon-play-2.3.x/src/main/scala/kamon/play/Play.scala @@ -16,32 +16,27 @@ package kamon.play -import akka.actor.{ ExtendedActorSystem, Extension, ExtensionId, ExtensionIdProvider } -import akka.event.Logging +import akka.actor._ import kamon.Kamon import kamon.util.http.HttpServerMetrics +import org.slf4j.LoggerFactory import play.api.libs.ws.WSRequest import play.api.mvc.RequestHeader -object Play extends ExtensionId[PlayExtension] with ExtensionIdProvider { - override def lookup(): ExtensionId[_ <: Extension] = Play - override def createExtension(system: ExtendedActorSystem): PlayExtension = new PlayExtension(system) - +object PlayExtension { val SegmentLibraryName = "WS-client" -} -class PlayExtension(private val system: ExtendedActorSystem) extends Kamon.Extension { - val log = Logging(system, classOf[PlayExtension]) - log.info(s"Starting the Kamon(Play) extension") + val log = LoggerFactory.getLogger("kamon.play.PlayExtension") + private val dynamic = new ReflectiveDynamicAccess(getClass.getClassLoader) - private val config = system.settings.config.getConfig("kamon.play") + private val config = Kamon.config.getConfig("kamon.play") val httpServerMetrics = Kamon.metrics.entity(HttpServerMetrics, "play-server") val includeTraceToken: Boolean = config.getBoolean("automatic-trace-token-propagation") val traceTokenHeaderName: String = config.getString("trace-token-header-name") private val nameGeneratorFQN = config.getString("name-generator") - private val nameGenerator: NameGenerator = system.dynamicAccess.createInstanceFor[NameGenerator](nameGeneratorFQN, Nil).get + private val nameGenerator: NameGenerator = dynamic.createInstanceFor[NameGenerator](nameGeneratorFQN, Nil).get def generateTraceName(requestHeader: RequestHeader): String = nameGenerator.generateTraceName(requestHeader) def generateHttpClientSegmentName(request: WSRequest): String = nameGenerator.generateHttpClientSegmentName(request) |