aboutsummaryrefslogtreecommitdiff
path: root/kamon-core/src/main/scala/kamon/metric
diff options
context:
space:
mode:
authorIvan Topolnjak <ivantopo@gmail.com>2017-06-15 22:56:17 +0200
committerIvan Topolnjak <ivantopo@gmail.com>2017-06-15 22:56:17 +0200
commitbc481389e427c83069b092e24200dbe960aaeb67 (patch)
tree56fc96d258d4d921880610cde811d24c8c675784 /kamon-core/src/main/scala/kamon/metric
parent8aa64c486f2ad1f31a5f27a0780f8c43f31b7f8c (diff)
downloadKamon-bc481389e427c83069b092e24200dbe960aaeb67.tar.gz
Kamon-bc481389e427c83069b092e24200dbe960aaeb67.tar.bz2
Kamon-bc481389e427c83069b092e24200dbe960aaeb67.zip
expose the internal scheduler
Diffstat (limited to 'kamon-core/src/main/scala/kamon/metric')
-rw-r--r--kamon-core/src/main/scala/kamon/metric/MetricRegistry.scala7
1 files changed, 3 insertions, 4 deletions
diff --git a/kamon-core/src/main/scala/kamon/metric/MetricRegistry.scala b/kamon-core/src/main/scala/kamon/metric/MetricRegistry.scala
index cecc2c19..07c1d202 100644
--- a/kamon-core/src/main/scala/kamon/metric/MetricRegistry.scala
+++ b/kamon-core/src/main/scala/kamon/metric/MetricRegistry.scala
@@ -24,13 +24,12 @@ import kamon.util.MeasurementUnit
import scala.collection.concurrent.TrieMap
import java.time.Duration
-import java.util.concurrent.Executors
+import java.util.concurrent.ScheduledExecutorService
import org.slf4j.LoggerFactory
-class MetricRegistry(initialConfig: Config) extends MetricsSnapshotGenerator {
- private val registryExecutionContext = Executors.newScheduledThreadPool(2, threadFactory("kamon-min-max-counter-sampler"))
+class MetricRegistry(initialConfig: Config, scheduler: ScheduledExecutorService) extends MetricsSnapshotGenerator {
private val logger = LoggerFactory.getLogger(classOf[MetricRegistry])
private val instrumentFactory = new AtomicReference[InstrumentFactory]()
private val metrics = TrieMap.empty[String, BaseMetric[_, _]]
@@ -52,7 +51,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, registryExecutionContext))
+ lookupMetric(name, unit, InstrumentTypes.MinMaxCounter)(new MinMaxCounterMetricImpl(name, unit, dynamicRange, sampleInterval, instrumentFactory, scheduler))
override def snapshot(): MetricsSnapshot = synchronized {