diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2017-12-12 15:00:59 +0100 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2017-12-13 00:48:38 +0100 |
commit | 686040cb569283667b967494be4a7088ef35964c (patch) | |
tree | 95873e59bad8c859a14f55a1cc42758c87901d26 /kamon-core/src/main/scala/kamon/Kamon.scala | |
parent | 66cf166772712267aac922c51ded90c7dec3bdd5 (diff) | |
download | Kamon-686040cb569283667b967494be4a7088ef35964c.tar.gz Kamon-686040cb569283667b967494be4a7088ef35964c.tar.bz2 Kamon-686040cb569283667b967494be4a7088ef35964c.zip |
use a specialized java.time.Clock exposed through the Kamon companion object
Diffstat (limited to 'kamon-core/src/main/scala/kamon/Kamon.scala')
-rw-r--r-- | kamon-core/src/main/scala/kamon/Kamon.scala | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/kamon-core/src/main/scala/kamon/Kamon.scala b/kamon-core/src/main/scala/kamon/Kamon.scala index 83a9a3d5..7ea9fa64 100644 --- a/kamon-core/src/main/scala/kamon/Kamon.scala +++ b/kamon-core/src/main/scala/kamon/Kamon.scala @@ -22,7 +22,7 @@ import com.typesafe.config.{Config, ConfigFactory} import kamon.context.{Codecs, Context, Key, Storage} import kamon.metric._ import kamon.trace._ -import kamon.util.{Filters, Registration} +import kamon.util.{Filters, Registration, Clock} import org.slf4j.LoggerFactory import scala.concurrent.Future @@ -36,10 +36,11 @@ object Kamon extends MetricLookup with ReporterRegistry with Tracer { @volatile private var _environment = Environment.fromConfig(_config) @volatile private var _filters = Filters.fromConfig(_config) + private val _clock = new Clock.Default() private val _scheduler = Executors.newScheduledThreadPool(schedulerPoolSize(_config), numberedThreadFactory("kamon-scheduler")) private val _metrics = new MetricRegistry(_config, _scheduler) - private val _reporterRegistry = new ReporterRegistry.Default(_metrics, _config) - private val _tracer = Tracer.Default(Kamon, _reporterRegistry, _config) + private val _reporterRegistry = new ReporterRegistry.Default(_metrics, _config, _clock) + private val _tracer = Tracer.Default(Kamon, _reporterRegistry, _config, _clock) private val _contextStorage = Storage.ThreadLocal() private val _contextCodec = new Codecs(_config) private var _onReconfigureHooks = Seq.empty[OnReconfigureHook] @@ -163,6 +164,9 @@ object Kamon extends MetricLookup with ReporterRegistry with Tracer { def filter(filterName: String, pattern: String): Boolean = _filters.accept(filterName, pattern) + def clock(): Clock = + _clock + /** * Register a reconfigure hook that will be run when the a call to Kamon.reconfigure(config) is performed. All * registered hooks will run sequentially in the same Thread that calls Kamon.reconfigure(config). |