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-annotation/src/main | |
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-annotation/src/main')
4 files changed, 10 insertions, 17 deletions
diff --git a/kamon-annotation/src/main/scala/kamon/annotation/Annotation.scala b/kamon-annotation/src/main/scala/kamon/annotation/Annotation.scala index 6ddf57cf..4a1eed94 100644 --- a/kamon-annotation/src/main/scala/kamon/annotation/Annotation.scala +++ b/kamon-annotation/src/main/scala/kamon/annotation/Annotation.scala @@ -18,17 +18,12 @@ package kamon.annotation import akka.actor.{ ExtendedActorSystem, Extension, ExtensionId, ExtensionIdProvider } import akka.event.Logging import kamon.Kamon +import org.slf4j.LoggerFactory -object Annotation extends ExtensionId[AnnotationExtension] with ExtensionIdProvider { - override def lookup(): ExtensionId[_ <: Extension] = Annotation - override def createExtension(system: ExtendedActorSystem): AnnotationExtension = new AnnotationExtension(system) -} - -class AnnotationExtension(system: ExtendedActorSystem) extends Kamon.Extension { - val log = Logging(system, classOf[AnnotationExtension]) - log.info(s"Starting the Kamon(Annotation) extension") +object AnnotationExtension { + val log = LoggerFactory.getLogger("kamon.annotation.Annotation") - val config = system.settings.config.getConfig("kamon.annotation") + val config = Kamon.config.getConfig("kamon.annotation") val arraySize = config.getInt("instruments-array-size") } diff --git a/kamon-annotation/src/main/scala/kamon/annotation/el/EnhancedELProcessor.scala b/kamon-annotation/src/main/scala/kamon/annotation/el/EnhancedELProcessor.scala index f407930b..a0e42afd 100644 --- a/kamon-annotation/src/main/scala/kamon/annotation/el/EnhancedELProcessor.scala +++ b/kamon-annotation/src/main/scala/kamon/annotation/el/EnhancedELProcessor.scala @@ -18,8 +18,7 @@ package kamon.annotation.el import javax.el.ELProcessor -import kamon.Kamon -import kamon.annotation.Annotation +import kamon.annotation.AnnotationExtension import scala.util.{ Failure, Success, Try } @@ -36,7 +35,7 @@ object EnhancedELProcessor { eval[String](str) match { case Success(value) ⇒ value case Failure(cause) ⇒ - Kamon(Annotation).log.error(s"${cause.getMessage} -> we will complete the operation with 'unknown' string") + AnnotationExtension.log.error(s"${cause.getMessage} -> we will complete the operation with 'unknown' string") "unknown" } } getOrElse expression @@ -45,7 +44,7 @@ object EnhancedELProcessor { eval[Map[String, String]](s"{$str}") match { case Success(value) ⇒ value.asInstanceOf[java.util.HashMap[String, String]].asScala.toMap case Failure(cause) ⇒ - Kamon(Annotation).log.error(s"${cause.getMessage} -> we will complete the operation with an empty map") + AnnotationExtension.log.error(s"${cause.getMessage} -> we will complete the operation with an empty map") Map.empty[String, String] } } getOrElse Map.empty[String, String] diff --git a/kamon-annotation/src/main/scala/kamon/annotation/instrumentation/AnnotationInstrumentation.scala b/kamon-annotation/src/main/scala/kamon/annotation/instrumentation/AnnotationInstrumentation.scala index bfeac62a..e5d1aff9 100644 --- a/kamon-annotation/src/main/scala/kamon/annotation/instrumentation/AnnotationInstrumentation.scala +++ b/kamon-annotation/src/main/scala/kamon/annotation/instrumentation/AnnotationInstrumentation.scala @@ -29,7 +29,7 @@ class AnnotationInstrumentation extends BaseAnnotationInstrumentation { @After("execution((@kamon.annotation.EnableKamon AnnotationInstruments+).new(..)) && this(obj)") def creation(jps: JoinPoint.StaticPart, obj: AnnotationInstruments): Unit = { - val size = Kamon(Annotation).arraySize + val size = AnnotationExtension.arraySize obj.traces = new AtomicReferenceArray[TraceContextInfo](size) obj.segments = new AtomicReferenceArray[SegmentInfo](size) obj.counters = new AtomicReferenceArray[Counter](size) diff --git a/kamon-annotation/src/main/scala/kamon/annotation/instrumentation/StaticAnnotationInstrumentation.scala b/kamon-annotation/src/main/scala/kamon/annotation/instrumentation/StaticAnnotationInstrumentation.scala index 2320cc09..73112f5c 100644 --- a/kamon-annotation/src/main/scala/kamon/annotation/instrumentation/StaticAnnotationInstrumentation.scala +++ b/kamon-annotation/src/main/scala/kamon/annotation/instrumentation/StaticAnnotationInstrumentation.scala @@ -18,8 +18,7 @@ package kamon.annotation.instrumentation import java.util.concurrent.atomic.AtomicReferenceArray -import kamon.Kamon -import kamon.annotation.Annotation +import kamon.annotation.AnnotationExtension import kamon.metric.instrument import kamon.metric.instrument.{ Counter, MinMaxCounter } import org.aspectj.lang.annotation.{ After, AfterReturning, Around, Aspect } @@ -30,7 +29,7 @@ class StaticAnnotationInstrumentation extends BaseAnnotationInstrumentation with @After("staticinitialization(*) && !within(kamon.annotation.instrumentation.*)") def creation(jps: JoinPoint.StaticPart): Unit = { - val size = Kamon(Annotation).arraySize + val size = AnnotationExtension.arraySize traces = new AtomicReferenceArray[TraceContextInfo](size) segments = new AtomicReferenceArray[SegmentInfo](size) counters = new AtomicReferenceArray[Counter](size) |