diff options
Diffstat (limited to 'kamon-core/src/main')
4 files changed, 13 insertions, 15 deletions
diff --git a/kamon-core/src/main/scala/kamon/metric/instrument/InstrumentSettings.scala b/kamon-core/src/main/scala/kamon/metric/instrument/InstrumentSettings.scala index 1446a25d..4423964a 100644 --- a/kamon-core/src/main/scala/kamon/metric/instrument/InstrumentSettings.scala +++ b/kamon-core/src/main/scala/kamon/metric/instrument/InstrumentSettings.scala @@ -20,14 +20,14 @@ case class InstrumentCustomSettings(lowestDiscernibleValue: Option[Long], highes } object InstrumentCustomSettings { - import scala.concurrent.duration._ + import kamon.util.ConfigTools.Syntax def fromConfig(config: Config): InstrumentCustomSettings = InstrumentCustomSettings( if (config.hasPath("lowest-discernible-value")) Some(config.getLong("lowest-discernible-value")) else None, if (config.hasPath("highest-trackable-value")) Some(config.getLong("highest-trackable-value")) else None, if (config.hasPath("precision")) Some(InstrumentSettings.parsePrecision(config.getString("precision"))) else None, - if (config.hasPath("refresh-interval")) Some(config.getDuration("refresh-interval", TimeUnit.NANOSECONDS).nanos) else None) + if (config.hasPath("refresh-interval")) Some(config.getFiniteDuration("refresh-interval")) else None) } @@ -54,13 +54,13 @@ case class DefaultInstrumentSettings(histogram: InstrumentSettings, minMaxCounte object DefaultInstrumentSettings { def fromConfig(config: Config): DefaultInstrumentSettings = { - import scala.concurrent.duration._ + import kamon.util.ConfigTools.Syntax val histogramSettings = InstrumentSettings(InstrumentSettings.readDynamicRange(config.getConfig("histogram")), None) val minMaxCounterSettings = InstrumentSettings(InstrumentSettings.readDynamicRange(config.getConfig("min-max-counter")), - Some(config.getDuration("min-max-counter.refresh-interval", TimeUnit.NANOSECONDS).nanos)) + Some(config.getFiniteDuration("min-max-counter.refresh-interval"))) val gaugeSettings = InstrumentSettings(InstrumentSettings.readDynamicRange(config.getConfig("gauge")), - Some(config.getDuration("gauge.refresh-interval", TimeUnit.NANOSECONDS).nanos)) + Some(config.getFiniteDuration("gauge.refresh-interval"))) DefaultInstrumentSettings(histogramSettings, minMaxCounterSettings, gaugeSettings) } diff --git a/kamon-core/src/main/scala/kamon/trace/Incubator.scala b/kamon-core/src/main/scala/kamon/trace/Incubator.scala index 3b2a3bf9..05279d95 100644 --- a/kamon-core/src/main/scala/kamon/trace/Incubator.scala +++ b/kamon-core/src/main/scala/kamon/trace/Incubator.scala @@ -16,24 +16,22 @@ package kamon.trace -import java.util.concurrent.TimeUnit - import akka.actor.{ ActorLogging, Props, Actor, ActorRef } import kamon.trace.Incubator.{ CheckForCompletedTraces, IncubatingTrace } import kamon.util.{ NanoInterval, RelativeNanoTimestamp } import scala.annotation.tailrec import scala.collection.immutable.Queue -import scala.concurrent.duration._ +import kamon.util.ConfigTools.Syntax class Incubator(subscriptions: ActorRef) extends Actor with ActorLogging { import context.dispatcher val config = context.system.settings.config.getConfig("kamon.trace.incubator") - val minIncubationTime = new NanoInterval(config.getDuration("min-incubation-time", TimeUnit.NANOSECONDS)) - val maxIncubationTime = new NanoInterval(config.getDuration("max-incubation-time", TimeUnit.NANOSECONDS)) - val checkInterval = config.getDuration("check-interval", TimeUnit.MILLISECONDS) + val minIncubationTime = new NanoInterval(config.getFiniteDuration("min-incubation-time").toNanos) + val maxIncubationTime = new NanoInterval(config.getFiniteDuration("max-incubation-time").toNanos) + val checkInterval = config.getFiniteDuration("check-interval") - val checkSchedule = context.system.scheduler.schedule(checkInterval.millis, checkInterval.millis, self, CheckForCompletedTraces) + val checkSchedule = context.system.scheduler.schedule(checkInterval, checkInterval, self, CheckForCompletedTraces) var waitingForMinimumIncubation = Queue.empty[IncubatingTrace] var waitingForIncubationFinish = List.empty[IncubatingTrace] diff --git a/kamon-core/src/main/scala/kamon/trace/TracerExtensionSettings.scala b/kamon-core/src/main/scala/kamon/trace/TracerExtensionSettings.scala index 7510ab7f..6167a007 100644 --- a/kamon-core/src/main/scala/kamon/trace/TracerExtensionSettings.scala +++ b/kamon-core/src/main/scala/kamon/trace/TracerExtensionSettings.scala @@ -17,7 +17,7 @@ package kamon.trace import java.util.concurrent.TimeUnit - +import kamon.util.ConfigTools.Syntax import com.typesafe.config.Config case class TraceSettings(levelOfDetail: LevelOfDetail, sampler: Sampler) @@ -38,7 +38,7 @@ object TraceSettings { case "all" ⇒ SampleAll case "random" ⇒ new RandomSampler(tracerConfig.getInt("random-sampler.chance")) case "ordered" ⇒ new OrderedSampler(tracerConfig.getInt("ordered-sampler.interval")) - case "threshold" ⇒ new ThresholdSampler(tracerConfig.getDuration("threshold-sampler.minimum-elapsed-time", TimeUnit.NANOSECONDS)) + case "threshold" ⇒ new ThresholdSampler(tracerConfig.getFiniteDuration("threshold-sampler.minimum-elapsed-time").toNanos) } TraceSettings(detailLevel, sampler) diff --git a/kamon-core/src/main/scala/kamon/util/ConfigTools.scala b/kamon-core/src/main/scala/kamon/util/ConfigTools.scala index 483278bf..bcec22c3 100644 --- a/kamon-core/src/main/scala/kamon/util/ConfigTools.scala +++ b/kamon-core/src/main/scala/kamon/util/ConfigTools.scala @@ -28,7 +28,7 @@ object ConfigTools { // versions of Akka using older typesafe-config versions. def getFiniteDuration(path: String): FiniteDuration = - FiniteDuration(config.getNanoseconds(path), TimeUnit.NANOSECONDS) + FiniteDuration(config.getDuration(path, TimeUnit.NANOSECONDS), TimeUnit.NANOSECONDS) def firstLevelKeys: Set[String] = { import scala.collection.JavaConverters._ |