From 3b5345c6790fb7f3ba334325243751a061f9574f Mon Sep 17 00:00:00 2001 From: Ivan Topolnjak Date: Thu, 15 Jun 2017 13:44:02 +0200 Subject: refactor topLevelKeys extension on Config --- kamon-core/src/main/scala/kamon/metric/MetricRegistry.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'kamon-core/src/main/scala/kamon/metric/MetricRegistry.scala') diff --git a/kamon-core/src/main/scala/kamon/metric/MetricRegistry.scala b/kamon-core/src/main/scala/kamon/metric/MetricRegistry.scala index eada120a..cecc2c19 100644 --- a/kamon-core/src/main/scala/kamon/metric/MetricRegistry.scala +++ b/kamon-core/src/main/scala/kamon/metric/MetricRegistry.scala @@ -24,11 +24,13 @@ import kamon.util.MeasurementUnit import scala.collection.concurrent.TrieMap import java.time.Duration +import java.util.concurrent.Executors import org.slf4j.LoggerFactory class MetricRegistry(initialConfig: Config) extends MetricsSnapshotGenerator { + private val registryExecutionContext = Executors.newScheduledThreadPool(2, threadFactory("kamon-min-max-counter-sampler")) private val logger = LoggerFactory.getLogger(classOf[MetricRegistry]) private val instrumentFactory = new AtomicReference[InstrumentFactory]() private val metrics = TrieMap.empty[String, BaseMetric[_, _]] @@ -50,7 +52,7 @@ class MetricRegistry(initialConfig: Config) extends MetricsSnapshotGenerator { lookupMetric(name, unit, InstrumentTypes.Gauge)(new GaugeMetricImpl(name, unit, instrumentFactory)) def minMaxCounter(name: String, unit: MeasurementUnit, dynamicRange: Option[DynamicRange], sampleInterval: Option[Duration]): MinMaxCounterMetric = - lookupMetric(name, unit, InstrumentTypes.MinMaxCounter)(new MinMaxCounterMetricImpl(name, unit, dynamicRange, sampleInterval, instrumentFactory)) + lookupMetric(name, unit, InstrumentTypes.MinMaxCounter)(new MinMaxCounterMetricImpl(name, unit, dynamicRange, sampleInterval, instrumentFactory, registryExecutionContext)) override def snapshot(): MetricsSnapshot = synchronized { -- cgit v1.2.3