diff options
Diffstat (limited to 'kamon-core/src/main')
-rw-r--r-- | kamon-core/src/main/scala/kamon/ModuleLoader.scala | 6 | ||||
-rw-r--r-- | kamon-core/src/main/scala/kamon/metric/EntityRecorder.scala | 6 | ||||
-rw-r--r-- | kamon-core/src/main/scala/kamon/util/Timestamp.scala | 6 |
3 files changed, 15 insertions, 3 deletions
diff --git a/kamon-core/src/main/scala/kamon/ModuleLoader.scala b/kamon-core/src/main/scala/kamon/ModuleLoader.scala index 602ee819..b594d4cf 100644 --- a/kamon-core/src/main/scala/kamon/ModuleLoader.scala +++ b/kamon-core/src/main/scala/kamon/ModuleLoader.scala @@ -35,18 +35,18 @@ private[kamon] class ModuleLoaderExtension(system: ExtendedActorSystem) extends logAspectJWeaverMissing(settings.modulesRequiringAspectJ) // Force initialization of all modules marked with auto-start. - settings.availableModules.foreach { + settings.availableModules.filter(_.startInfo.nonEmpty).foreach { case AvailableModuleInfo(name, requiresAJ, Some(ModuleStartInfo(autoStart, extensionClass))) if autoStart ⇒ system.dynamicAccess.getObjectFor[ExtensionId[Kamon.Extension]](extensionClass).map { moduleID ⇒ log.debug(s"Auto starting the [$name] module.") moduleID.get(system) - + } recover { case th: Throwable ⇒ log.error(s"Failed to auto start the [$name] module.", th) } - case _ ⇒ //ignore + case other => } diff --git a/kamon-core/src/main/scala/kamon/metric/EntityRecorder.scala b/kamon-core/src/main/scala/kamon/metric/EntityRecorder.scala index 71b40ea6..c1392d4d 100644 --- a/kamon-core/src/main/scala/kamon/metric/EntityRecorder.scala +++ b/kamon-core/src/main/scala/kamon/metric/EntityRecorder.scala @@ -34,6 +34,12 @@ trait EntityRecorderFactory[T <: EntityRecorder] { def createRecorder(instrumentFactory: InstrumentFactory): T } +abstract class EntityRecorderFactoryCompanion[T <: EntityRecorder](val category: String, builder: (InstrumentFactory) => T) + extends EntityRecorderFactory[T] { + + def createRecorder(instrumentFactory: InstrumentFactory): T = builder(instrumentFactory) +} + object EntityRecorderFactory { def apply[T <: EntityRecorder](entityCategory: String, factory: InstrumentFactory ⇒ T): EntityRecorderFactory[T] = new EntityRecorderFactory[T] { diff --git a/kamon-core/src/main/scala/kamon/util/Timestamp.scala b/kamon-core/src/main/scala/kamon/util/Timestamp.scala index eadc6690..5a192304 100644 --- a/kamon-core/src/main/scala/kamon/util/Timestamp.scala +++ b/kamon-core/src/main/scala/kamon/util/Timestamp.scala @@ -59,6 +59,8 @@ object MilliTimestamp { * timestamp in nanoseconds. */ class NanoTimestamp(val nanos: Long) extends AnyVal { + def -(that: NanoTimestamp) = new NanoTimestamp(nanos - that.nanos) + def +(that: NanoTimestamp) = new NanoTimestamp(nanos + that.nanos) override def toString: String = String.valueOf(nanos) + ".nanos" } @@ -70,6 +72,8 @@ object NanoTimestamp { * Number of nanoseconds between a arbitrary origin timestamp provided by the JVM via System.nanoTime() */ class RelativeNanoTimestamp(val nanos: Long) extends AnyVal { + def -(that: RelativeNanoTimestamp) = new RelativeNanoTimestamp(nanos - that.nanos) + def +(that: RelativeNanoTimestamp) = new RelativeNanoTimestamp(nanos + that.nanos) override def toString: String = String.valueOf(nanos) + ".nanos" def toMilliTimestamp: MilliTimestamp = @@ -77,6 +81,8 @@ class RelativeNanoTimestamp(val nanos: Long) extends AnyVal { } object RelativeNanoTimestamp { + val zero = new RelativeNanoTimestamp(0L) + def now: RelativeNanoTimestamp = new RelativeNanoTimestamp(System.nanoTime()) def relativeTo(milliTimestamp: MilliTimestamp): RelativeNanoTimestamp = new RelativeNanoTimestamp(now.nanos - (MilliTimestamp.now.millis - milliTimestamp.millis) * 1000000) |