aboutsummaryrefslogtreecommitdiff
path: root/kamon-core/src/test/scala/kamon/metric
diff options
context:
space:
mode:
authorIvan Topolnjak <ivantopo@gmail.com>2017-08-15 00:33:06 +0200
committerIvan Topolnjak <ivantopo@gmail.com>2017-08-15 00:33:06 +0200
commita90d4aa75e7fdf12a85177f4e81463439bfe5bb3 (patch)
tree2b815c06862332752ff4192c4bdceb4413cf2945 /kamon-core/src/test/scala/kamon/metric
parent86c72d622ac027dc96f9a744771c0a468d46dc60 (diff)
downloadKamon-a90d4aa75e7fdf12a85177f4e81463439bfe5bb3.tar.gz
Kamon-a90d4aa75e7fdf12a85177f4e81463439bfe5bb3.tar.bz2
Kamon-a90d4aa75e7fdf12a85177f4e81463439bfe5bb3.zip
separate the build into core, testkit and core-tests projects
Diffstat (limited to 'kamon-core/src/test/scala/kamon/metric')
-rw-r--r--kamon-core/src/test/scala/kamon/metric/FilterSpec.scala72
-rw-r--r--kamon-core/src/test/scala/kamon/metric/GlobPathFilterSpec.scala72
-rw-r--r--kamon-core/src/test/scala/kamon/metric/HistogramSpec.scala94
-rw-r--r--kamon-core/src/test/scala/kamon/metric/LongAdderCounterSpec.scala62
-rw-r--r--kamon-core/src/test/scala/kamon/metric/MetricLookupSpec.scala62
-rw-r--r--kamon-core/src/test/scala/kamon/metric/MinMaxCounterSpec.scala90
-rw-r--r--kamon-core/src/test/scala/kamon/metric/RecorderRegistrySpec.scala58
-rw-r--r--kamon-core/src/test/scala/kamon/metric/RegexPathFilterSpec.scala61
-rw-r--r--kamon-core/src/test/scala/kamon/metric/TimerSpec.scala72
-rw-r--r--kamon-core/src/test/scala/kamon/metric/instrument/InstrumentFactorySpec.scala114
10 files changed, 0 insertions, 757 deletions
diff --git a/kamon-core/src/test/scala/kamon/metric/FilterSpec.scala b/kamon-core/src/test/scala/kamon/metric/FilterSpec.scala
deleted file mode 100644
index cda76dc2..00000000
--- a/kamon-core/src/test/scala/kamon/metric/FilterSpec.scala
+++ /dev/null
@@ -1,72 +0,0 @@
-package kamon
-package metric
-
-import com.typesafe.config.ConfigFactory
-import org.scalatest.{Matchers, WordSpec}
-
-
-class FilterSpec extends WordSpec with Matchers {
- val testConfig = ConfigFactory.parseString(
- """
- |kamon.util.filters {
- |
- | some-filter {
- | includes = ["**"]
- | excludes = ["not-me"]
- | }
- |
- | only-includes {
- | includes = ["only-me"]
- | }
- |
- | only-excludes {
- | excludes = ["not-me"]
- | }
- |
- | specific-rules {
- | includes = ["glob:/user/**", "regex:test-[0-5]"]
- | }
- |
- | "filter.with.quotes" {
- | includes = ["**"]
- | excludes = ["not-me"]
- | }
- |}
- """.stripMargin
- )
-
- Kamon.reconfigure(testConfig.withFallback(Kamon.config()))
-
- "the entity filters" should {
- "reject anything that doesn't match any configured filter" in {
- Kamon.filter("not-a-filter", "hello") shouldBe false
- }
-
- "evaluate patterns for filters with includes and excludes" in {
- Kamon.filter("some-filter", "anything") shouldBe true
- Kamon.filter("some-filter", "some-other") shouldBe true
- Kamon.filter("some-filter", "not-me") shouldBe false
- }
-
- "allow configuring includes only or excludes only for any filter" in {
- Kamon.filter("only-includes", "only-me") shouldBe true
- Kamon.filter("only-includes", "anything") shouldBe false
- Kamon.filter("only-excludes", "any-other") shouldBe false
- Kamon.filter("only-excludes", "not-me") shouldBe false
- }
-
- "allow to explicitly decide whether patterns are treated as Glob or Regex" in {
- Kamon.filter("specific-rules", "/user/accepted") shouldBe true
- Kamon.filter("specific-rules", "/other/rejected/") shouldBe false
- Kamon.filter("specific-rules", "test-5") shouldBe true
- Kamon.filter("specific-rules", "test-6") shouldBe false
- }
-
- "allow filters with quoted names" in {
- Kamon.filter("filter.with.quotes", "anything") shouldBe true
- Kamon.filter("filter.with.quotes", "some-other") shouldBe true
- Kamon.filter("filter.with.quotes", "not-me") shouldBe false
- }
-
- }
-}
diff --git a/kamon-core/src/test/scala/kamon/metric/GlobPathFilterSpec.scala b/kamon-core/src/test/scala/kamon/metric/GlobPathFilterSpec.scala
deleted file mode 100644
index c21b1256..00000000
--- a/kamon-core/src/test/scala/kamon/metric/GlobPathFilterSpec.scala
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * =========================================================================================
- * Copyright © 2013-2017 the kamon project <http://kamon.io/>
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language governing permissions
- * and limitations under the License.
- * =========================================================================================
- */
-
-package kamon
-package metric
-
-import kamon.util.GlobPathFilter
-import org.scalatest.{Matchers, WordSpecLike}
-
-class GlobPathFilterSpec extends WordSpecLike with Matchers {
- "The GlobPathFilter" should {
-
- "match a single expression" in {
- val filter = new GlobPathFilter("/user/actor")
-
- filter.accept("/user/actor") shouldBe true
- filter.accept("/user/actor/something") shouldBe false
- filter.accept("/user/actor/somethingElse") shouldBe false
- }
-
- "match all expressions in the same level" in {
- val filter = new GlobPathFilter("/user/*")
-
- filter.accept("/user/actor") shouldBe true
- filter.accept("/user/otherActor") shouldBe true
- filter.accept("/user/something/actor") shouldBe false
- filter.accept("/user/something/otherActor") shouldBe false
- }
-
- "match any expressions when using double star alone (**)" in {
- val filter = new GlobPathFilter("**")
-
- filter.accept("GET: /ping") shouldBe true
- filter.accept("GET: /ping/pong") shouldBe true
- filter.accept("this-doesn't_look good but-passes") shouldBe true
- }
-
- "match all expressions and cross the path boundaries when using double star suffix (**)" in {
- val filter = new GlobPathFilter("/user/actor-**")
-
- filter.accept("/user/actor-") shouldBe true
- filter.accept("/user/actor-one") shouldBe true
- filter.accept("/user/actor-one/other") shouldBe true
- filter.accept("/user/something/actor") shouldBe false
- filter.accept("/user/something/otherActor") shouldBe false
- }
-
- "match exactly one character when using question mark (?)" in {
- val filter = new GlobPathFilter("/user/actor-?")
-
- filter.accept("/user/actor-1") shouldBe true
- filter.accept("/user/actor-2") shouldBe true
- filter.accept("/user/actor-3") shouldBe true
- filter.accept("/user/actor-one") shouldBe false
- filter.accept("/user/actor-two") shouldBe false
- filter.accept("/user/actor-tree") shouldBe false
- }
- }
-}
diff --git a/kamon-core/src/test/scala/kamon/metric/HistogramSpec.scala b/kamon-core/src/test/scala/kamon/metric/HistogramSpec.scala
deleted file mode 100644
index f0ea1292..00000000
--- a/kamon-core/src/test/scala/kamon/metric/HistogramSpec.scala
+++ /dev/null
@@ -1,94 +0,0 @@
-package kamon.metric
-
-import kamon.Kamon
-import org.scalatest.{Matchers, WordSpec}
-import MeasurementUnit._
-
-
-class HistogramSpec extends WordSpec with Matchers {
- import HistogramTestHelper.HistogramMetricSyntax
-
- "a Histogram" should {
- "record values and reset internal state when a snapshot is taken" in {
- val histogram = Kamon.histogram("test", unit = time.nanoseconds)
- histogram.record(100)
- histogram.record(150, 998)
- histogram.record(200)
-
- val distribution = histogram.distribution()
- distribution.min shouldBe(100)
- distribution.max shouldBe(200)
- distribution.count shouldBe(1000)
- distribution.buckets.length shouldBe 3
- distribution.buckets.map(b => (b.value, b.frequency)) should contain.allOf(
- (100 -> 1),
- (150 -> 998),
- (200 -> 1)
- )
-
- val emptyDistribution = histogram.distribution()
- emptyDistribution.min shouldBe(0)
- emptyDistribution.max shouldBe(0)
- emptyDistribution.count shouldBe(0)
- emptyDistribution.buckets.length shouldBe 0
- }
-
- "accept a smallest discernible value configuration" in {
- // The lowestDiscernibleValue gets rounded down to the closest power of 2, so, here it will be 64.
- val histogram = Kamon.histogram("test-lowest-discernible-value", unit = time.nanoseconds, dynamicRange = DynamicRange.Fine.withLowestDiscernibleValue(100))
- histogram.record(100)
- histogram.record(200)
- histogram.record(300)
- histogram.record(1000)
- histogram.record(2000)
- histogram.record(3000)
-
- val distribution = histogram.distribution()
- distribution.min shouldBe(64)
- distribution.max shouldBe(2944)
- distribution.count shouldBe(6)
- distribution.buckets.length shouldBe 6
- distribution.buckets.map(b => (b.value, b.frequency)) should contain.allOf(
- (64 -> 1),
- (192 -> 1),
- (256 -> 1),
- (960 -> 1),
- (1984 -> 1),
- (2944 -> 1)
- )
- }
-
- "[private api] record values and optionally keep the internal state when a snapshot is taken" in {
- val histogram = Kamon.histogram("test", unit = time.nanoseconds)
- histogram.record(100)
- histogram.record(150, 998)
- histogram.record(200)
-
- val distribution = {
- histogram.distribution(resetState = false) // first one gets discarded
- histogram.distribution(resetState = false)
- }
-
- distribution.min shouldBe(100)
- distribution.max shouldBe(200)
- distribution.count shouldBe(1000)
- distribution.buckets.length shouldBe 3
- distribution.buckets.map(b => (b.value, b.frequency)) should contain.allOf(
- (100 -> 1),
- (150 -> 998),
- (200 -> 1)
- )
- }
- }
-}
-
-object HistogramTestHelper {
-
- implicit class HistogramMetricSyntax(metric: HistogramMetric) {
- def distribution(resetState: Boolean = true): Distribution =
- metric.refine(Map.empty[String, String]) match {
- case h: AtomicHdrHistogram => h.snapshot(resetState).distribution
- case h: HdrHistogram => h.snapshot(resetState).distribution
- }
- }
-}
diff --git a/kamon-core/src/test/scala/kamon/metric/LongAdderCounterSpec.scala b/kamon-core/src/test/scala/kamon/metric/LongAdderCounterSpec.scala
deleted file mode 100644
index 4014d6df..00000000
--- a/kamon-core/src/test/scala/kamon/metric/LongAdderCounterSpec.scala
+++ /dev/null
@@ -1,62 +0,0 @@
-/* =========================================================================================
- * Copyright © 2013-2017 the kamon project <http://kamon.io/>
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language governing permissions
- * and limitations under the License.
- * =========================================================================================
- */
-
-package kamon.metric
-
-import org.scalatest.{Matchers, WordSpec}
-
-class LongAdderCounterSpec extends WordSpec with Matchers {
-
- "a LongAdderCounter" should {
- "allow unit and bundled increments" in {
- val counter = buildCounter("unit-increments")
- counter.increment()
- counter.increment()
- counter.increment(40)
-
- counter.snapshot().value shouldBe 42
- }
-
- "warn the user and ignore attempts to decrement the counter" in {
- val counter = buildCounter("attempt-to-decrement")
- counter.increment(100)
- counter.increment(100)
- counter.increment(100)
-
- counter.snapshot().value shouldBe 300
- }
-
- "reset the internal state to zero after taking snapshots as a default behavior" in {
- val counter = buildCounter("reset-after-snapshot")
- counter.increment()
- counter.increment(10)
-
- counter.snapshot().value shouldBe 11
- counter.snapshot().value shouldBe 0
- }
-
- "optionally leave the internal state unchanged" in {
- val counter = buildCounter("reset-after-snapshot")
- counter.increment()
- counter.increment(10)
-
- counter.snapshot(resetState = false).value shouldBe 11
- counter.snapshot(resetState = false).value shouldBe 11
- }
- }
-
- def buildCounter(name: String, tags: Map[String, String] = Map.empty, unit: MeasurementUnit = MeasurementUnit.none): LongAdderCounter =
- new LongAdderCounter(name, tags, unit)
-}
diff --git a/kamon-core/src/test/scala/kamon/metric/MetricLookupSpec.scala b/kamon-core/src/test/scala/kamon/metric/MetricLookupSpec.scala
deleted file mode 100644
index 1d60a28f..00000000
--- a/kamon-core/src/test/scala/kamon/metric/MetricLookupSpec.scala
+++ /dev/null
@@ -1,62 +0,0 @@
-package kamon.metric
-
-import kamon.Kamon
-import org.scalatest.{Matchers, WordSpec}
-
-class MetricLookupSpec extends WordSpec with Matchers {
-
- "the Kamon companion object" can {
- "lookup a metric and" should {
- "always return the same histogram metric" in {
- val histogramOne = Kamon.histogram("histogram-lookup")
- val histogramTwo = Kamon.histogram("histogram-lookup")
- histogramOne shouldBe theSameInstanceAs(histogramTwo)
- }
-
- "always return the same counter metric" in {
- val counterOne = Kamon.counter("counter-lookup")
- val counterTwo = Kamon.counter("counter-lookup")
- counterOne shouldBe theSameInstanceAs(counterTwo)
- }
-
- "always return the same gauge metric" in {
- val gaugeOne = Kamon.gauge("gauge-lookup")
- val gaugeTwo = Kamon.gauge("gauge-lookup")
- gaugeOne shouldBe theSameInstanceAs(gaugeTwo)
- }
-
- "always return the same min-max-counter metric" in {
- val minMaxCounterOne = Kamon.minMaxCounter("min-max-counter-lookup")
- val minMaxCounterTwo = Kamon.minMaxCounter("min-max-counter-lookup")
- minMaxCounterOne shouldBe theSameInstanceAs(minMaxCounterTwo)
- }
- }
-
- "refine a metric with tags and" should {
- "always return the same histogram for a set of tags" in {
- val histogramOne = Kamon.histogram("histogram-lookup").refine("tag" -> "value")
- val histogramTwo = Kamon.histogram("histogram-lookup").refine("tag" -> "value")
- histogramOne shouldBe theSameInstanceAs(histogramTwo)
- }
-
- "always return the same counter for a set of tags" in {
- val counterOne = Kamon.counter("counter-lookup").refine("tag" -> "value")
- val counterTwo = Kamon.counter("counter-lookup").refine("tag" -> "value")
- counterOne shouldBe theSameInstanceAs(counterTwo)
- }
-
- "always return the same gauge for a set of tags" in {
- val gaugeOne = Kamon.gauge("gauge-lookup").refine("tag" -> "value")
- val gaugeTwo = Kamon.gauge("gauge-lookup").refine("tag" -> "value")
- gaugeOne shouldBe theSameInstanceAs(gaugeTwo)
- }
-
- "always return the same min-max-counter for a set of tags" in {
- val minMaxCounterOne = Kamon.minMaxCounter("min-max-counter-lookup").refine("tag" -> "value")
- val minMaxCounterTwo = Kamon.minMaxCounter("min-max-counter-lookup").refine("tag" -> "value")
- minMaxCounterOne shouldBe theSameInstanceAs(minMaxCounterTwo)
- }
- }
- }
-
-}
diff --git a/kamon-core/src/test/scala/kamon/metric/MinMaxCounterSpec.scala b/kamon-core/src/test/scala/kamon/metric/MinMaxCounterSpec.scala
deleted file mode 100644
index 0ad3c45c..00000000
--- a/kamon-core/src/test/scala/kamon/metric/MinMaxCounterSpec.scala
+++ /dev/null
@@ -1,90 +0,0 @@
-/* =========================================================================================
- * Copyright © 2013-2017 the kamon project <http://kamon.io/>
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language governing permissions
- * and limitations under the License.
- * =========================================================================================
- */
-
-
-package kamon.metric
-
-import java.time.Duration
-
-import org.scalatest.{Matchers, WordSpec}
-
-case class TemporalBucket(value: Long, frequency: Long) extends Bucket
-
-class MinMaxCounterSpec extends WordSpec with Matchers {
-
- "a MinMaxCounter" should {
- "track ascending tendencies" in {
- val mmCounter = buildMinMaxCounter("track-ascending")
- mmCounter.increment()
- mmCounter.increment(3)
- mmCounter.increment()
-
- mmCounter.sample()
-
- val snapshot = mmCounter.snapshot()
-
- snapshot.distribution.min should be(0)
- snapshot.distribution.max should be(5)
- }
-
- "track descending tendencies" in {
- val mmCounter = buildMinMaxCounter("track-descending")
- mmCounter.increment(5)
- mmCounter.decrement()
- mmCounter.decrement(3)
- mmCounter.decrement()
-
- mmCounter.sample()
-
- val snapshot = mmCounter.snapshot()
- snapshot.distribution.min should be(0)
- snapshot.distribution.max should be(5)
- }
-
- "reset the min and max to the current value after taking a snapshot" in {
- val mmCounter = buildMinMaxCounter("reset-min-max-to-current")
-
- mmCounter.increment(5)
- mmCounter.decrement(3)
- mmCounter.sample()
-
- val firstSnapshot = mmCounter.snapshot()
- firstSnapshot.distribution.min should be(0)
- firstSnapshot.distribution.max should be(5)
-
- mmCounter.sample()
-
- val secondSnapshot = mmCounter.snapshot()
- secondSnapshot.distribution.min should be(2)
- secondSnapshot.distribution.max should be(2)
- }
-
- "report zero as the min and current values if the current value fell bellow zero" in {
- val mmCounter = buildMinMaxCounter("report-zero")
-
- mmCounter.decrement(3)
-
- mmCounter.sample()
-
- val snapshot = mmCounter.snapshot()
-
- snapshot.distribution.min should be(0)
- snapshot.distribution.max should be(0)
- }
- }
-
- def buildMinMaxCounter(name: String, tags: Map[String, String] = Map.empty, unit: MeasurementUnit = MeasurementUnit.none): SimpleMinMaxCounter =
- new SimpleMinMaxCounter(name, tags, new AtomicHdrHistogram(name, tags, unit, dynamicRange = DynamicRange.Default), Duration.ofMillis(100))
-} \ No newline at end of file
diff --git a/kamon-core/src/test/scala/kamon/metric/RecorderRegistrySpec.scala b/kamon-core/src/test/scala/kamon/metric/RecorderRegistrySpec.scala
deleted file mode 100644
index 1053aa5f..00000000
--- a/kamon-core/src/test/scala/kamon/metric/RecorderRegistrySpec.scala
+++ /dev/null
@@ -1,58 +0,0 @@
-/* =========================================================================================
- * Copyright © 2013-2017 the kamon project <http://kamon.io/>
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language governing permissions
- * and limitations under the License.
- * =========================================================================================
- */
-
-package kamon.metric
-
-import com.typesafe.config.ConfigFactory
-import org.scalatest.{Matchers, WordSpec}
-
-//class RecorderRegistrySpec extends WordSpec with Matchers {
-// private val testConfig = ConfigFactory.parseString(
-// """
-// |kamon.metric.filters {
-// | accept-unmatched = false
-// |
-// | my-category {
-// | includes = ["**"]
-// | excludes = ["excluded"]
-// | }
-// |}
-// """.stripMargin
-// )
-// private val recorderRegistry = new RecorderRegistryImpl(testConfig.withFallback(ConfigFactory.load()))
-//
-//
-// "the RecorderRegistry" should {
-// "create entity recorders as requested and always return the same instance for a given entity" in {
-// val myFirstEntityRecorder = recorderRegistry.getRecorder(Entity("my-entity", "my-category", Map.empty))
-// val mySecondEntityRecorder = recorderRegistry.getRecorder(Entity("my-entity", "my-category", Map.empty))
-// mySecondEntityRecorder shouldBe theSameInstanceAs(myFirstEntityRecorder)
-// }
-//
-// "properly advice regarding entity filtering read from configuration" in {
-// recorderRegistry.shouldTrack(Entity("my-entity", "my-category", Map.empty)) shouldBe true
-// recorderRegistry.shouldTrack(Entity("other-eny", "my-category", Map.empty)) shouldBe true
-// recorderRegistry.shouldTrack(Entity("excluded", "my-category", Map.empty)) shouldBe false
-// }
-//
-// "allow removing entities" in {
-// val myFirstEntityRecorder = recorderRegistry.getRecorder(Entity("my-entity", "my-category", Map.empty))
-// recorderRegistry.removeRecorder(Entity("my-entity", "my-category", Map.empty))
-//
-// val mySecondEntityRecorder = recorderRegistry.getRecorder(Entity("my-entity", "my-category", Map.empty))
-// mySecondEntityRecorder shouldNot be theSameInstanceAs(myFirstEntityRecorder)
-// }
-// }
-//}
diff --git a/kamon-core/src/test/scala/kamon/metric/RegexPathFilterSpec.scala b/kamon-core/src/test/scala/kamon/metric/RegexPathFilterSpec.scala
deleted file mode 100644
index f742df1d..00000000
--- a/kamon-core/src/test/scala/kamon/metric/RegexPathFilterSpec.scala
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * =========================================================================================
- * Copyright © 2013-2017 the kamon project <http://kamon.io/>
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language governing permissions
- * and limitations under the License.
- * =========================================================================================
- */
-
-package kamon
-package metric
-
-import kamon.util.RegexMatcher
-import org.scalatest.{Matchers, WordSpecLike}
-
-class RegexPathFilterSpec extends WordSpecLike with Matchers {
- "The RegexPathFilter" should {
-
- "match a single expression" in {
- val filter = new RegexMatcher("/user/actor")
-
- filter.accept("/user/actor") shouldBe true
-
- filter.accept("/user/actor/something") shouldBe false
- filter.accept("/user/actor/somethingElse") shouldBe false
- }
-
- "match arbitray expressions ending with wildcard" in {
- val filter = new RegexMatcher("/user/.*")
-
- filter.accept("/user/actor") shouldBe true
- filter.accept("/user/otherActor") shouldBe true
- filter.accept("/user/something/actor") shouldBe true
- filter.accept("/user/something/otherActor") shouldBe true
-
- filter.accept("/otheruser/actor") shouldBe false
- filter.accept("/otheruser/otherActor") shouldBe false
- filter.accept("/otheruser/something/actor") shouldBe false
- filter.accept("/otheruser/something/otherActor") shouldBe false
- }
-
- "match numbers" in {
- val filter = new RegexMatcher("/user/actor-\\d")
-
- filter.accept("/user/actor-1") shouldBe true
- filter.accept("/user/actor-2") shouldBe true
- filter.accept("/user/actor-3") shouldBe true
-
- filter.accept("/user/actor-one") shouldBe false
- filter.accept("/user/actor-two") shouldBe false
- filter.accept("/user/actor-tree") shouldBe false
- }
- }
-}
diff --git a/kamon-core/src/test/scala/kamon/metric/TimerSpec.scala b/kamon-core/src/test/scala/kamon/metric/TimerSpec.scala
deleted file mode 100644
index 3fc1e169..00000000
--- a/kamon-core/src/test/scala/kamon/metric/TimerSpec.scala
+++ /dev/null
@@ -1,72 +0,0 @@
-package kamon.metric
-
-import kamon.Kamon
-import org.scalatest.{Matchers, WordSpec}
-
-
-class TimerSpec extends WordSpec with Matchers {
- import TimerTestHelper._
-
- "a Timer" should {
- "record the duration between calls to .start() and .stop() in the StartedTimer" in {
- val timer = Kamon.timer("timer-spec")
- timer.start().stop()
- timer.start().stop()
- timer.start().stop()
-
- timer.distribution().count shouldBe(3)
- }
-
- "ensure that a started timer can only be stopped once" in {
- val timer = Kamon.timer("timer-spec")
- val startedTimer = timer.start()
- startedTimer.stop()
- startedTimer.stop()
- startedTimer.stop()
-
- timer.distribution().count shouldBe(1)
- }
-
-
- "allow to record values and produce distributions as Histograms do" in {
- val timer = Kamon.timer("test-timer")
- timer.record(100)
- timer.record(150, 998)
- timer.record(200)
-
- val distribution = timer.distribution()
- distribution.min shouldBe(100)
- distribution.max shouldBe(200)
- distribution.count shouldBe(1000)
- distribution.buckets.length shouldBe 3
- distribution.buckets.map(b => (b.value, b.frequency)) should contain.allOf(
- (100 -> 1),
- (150 -> 998),
- (200 -> 1)
- )
-
- val emptyDistribution = timer.distribution()
- emptyDistribution.min shouldBe(0)
- emptyDistribution.max shouldBe(0)
- emptyDistribution.count shouldBe(0)
- emptyDistribution.buckets.length shouldBe 0
- }
- }
-}
-
-object TimerTestHelper {
-
- implicit class HistogramMetricSyntax(histogram: Histogram) {
- def distribution(resetState: Boolean = true): Distribution = histogram match {
- case h: AtomicHdrHistogram => h.snapshot(resetState).distribution
- case h: HdrHistogram => h.snapshot(resetState).distribution
- }
- }
-
- implicit class TimerMetricSyntax(metric: TimerMetric) {
- def distribution(resetState: Boolean = true): Distribution =
- metric.refine(Map.empty[String, String]) match {
- case t: TimerImpl => t.histogram.distribution(resetState)
- }
- }
-}
diff --git a/kamon-core/src/test/scala/kamon/metric/instrument/InstrumentFactorySpec.scala b/kamon-core/src/test/scala/kamon/metric/instrument/InstrumentFactorySpec.scala
deleted file mode 100644
index 21fe2b4d..00000000
--- a/kamon-core/src/test/scala/kamon/metric/instrument/InstrumentFactorySpec.scala
+++ /dev/null
@@ -1,114 +0,0 @@
-package kamon.metric.instrument
-
-//import java.time.Duration
-//
-//import com.typesafe.config.ConfigFactory
-//import kamon.metric.Entity
-//import org.scalatest.{Matchers, WordSpec}
-//
-//class InstrumentFactorySpec extends WordSpec with Matchers{
-// val testEntity = Entity("test", "test-category", Map.empty)
-// val customEntity = Entity("test", "custom-category", Map.empty)
-// val baseConfiguration = ConfigFactory.parseString(
-// """
-// |kamon.metric.instrument-factory {
-// | default-settings {
-// | histogram {
-// | lowest-discernible-value = 100
-// | highest-trackable-value = 5000
-// | significant-value-digits = 2
-// | }
-// |
-// | min-max-counter {
-// | lowest-discernible-value = 200
-// | highest-trackable-value = 6000
-// | significant-value-digits = 3
-// | sample-interval = 647 millis
-// | }
-// | }
-// |
-// | custom-settings {
-// |
-// | }
-// |}
-// """.stripMargin
-// )
-//
-//
-// "the metrics InstrumentFactory" should {
-// "create instruments using the default configuration settings" in {
-// val factory = InstrumentFactory.fromConfig(baseConfiguration)
-// val histogram = factory.buildHistogram(testEntity, "my-histogram")
-// val mmCounter = factory.buildMinMaxCounter(testEntity, "my-mm-counter")
-//
-// histogram.dynamicRange.lowestDiscernibleValue shouldBe(100)
-// histogram.dynamicRange.highestTrackableValue shouldBe(5000)
-// histogram.dynamicRange.significantValueDigits shouldBe(2)
-//
-// mmCounter.dynamicRange.lowestDiscernibleValue shouldBe(200)
-// mmCounter.dynamicRange.highestTrackableValue shouldBe(6000)
-// mmCounter.dynamicRange.significantValueDigits shouldBe(3)
-// mmCounter.sampleInterval shouldBe(Duration.ofMillis(647))
-// }
-//
-// "accept custom settings when building instruments" in {
-// val factory = InstrumentFactory.fromConfig(baseConfiguration)
-// val histogram = factory.buildHistogram(testEntity, "my-histogram", DynamicRange.Loose)
-// val mmCounter = factory.buildMinMaxCounter(testEntity, "my-mm-counter", DynamicRange.Fine, Duration.ofMillis(500))
-//
-// histogram.dynamicRange shouldBe(DynamicRange.Loose)
-//
-// mmCounter.dynamicRange shouldBe(DynamicRange.Fine)
-// mmCounter.sampleInterval shouldBe(Duration.ofMillis(500))
-// }
-//
-// "allow overriding any default and provided settings via the custom-settings configuration key" in {
-// val customConfig = ConfigFactory.parseString(
-// """
-// |kamon.metric.instrument-factory.custom-settings {
-// | custom-category {
-// | modified-histogram {
-// | lowest-discernible-value = 99
-// | highest-trackable-value = 999
-// | significant-value-digits = 4
-// | }
-// |
-// | modified-mm-counter {
-// | lowest-discernible-value = 784
-// | highest-trackable-value = 14785
-// | significant-value-digits = 1
-// | sample-interval = 3 seconds
-// | }
-// | }
-// |}
-// """.stripMargin
-// ).withFallback(baseConfiguration)
-//
-// val factory = InstrumentFactory.fromConfig(customConfig)
-// val defaultHistogram = factory.buildHistogram(customEntity, "default-histogram")
-// val modifiedHistogram = factory.buildHistogram(customEntity, "modified-histogram", DynamicRange.Loose)
-//
-// defaultHistogram.dynamicRange.lowestDiscernibleValue shouldBe(100)
-// defaultHistogram.dynamicRange.highestTrackableValue shouldBe(5000)
-// defaultHistogram.dynamicRange.significantValueDigits shouldBe(2)
-//
-// modifiedHistogram.dynamicRange.lowestDiscernibleValue shouldBe(99)
-// modifiedHistogram.dynamicRange.highestTrackableValue shouldBe(999)
-// modifiedHistogram.dynamicRange.significantValueDigits shouldBe(4)
-//
-//
-// val defaultMMCounter = factory.buildMinMaxCounter(customEntity, "default-mm-counter")
-// val modifiedMMCounter = factory.buildMinMaxCounter(customEntity, "modified-mm-counter", DynamicRange.Loose)
-//
-// defaultMMCounter.dynamicRange.lowestDiscernibleValue shouldBe(200)
-// defaultMMCounter.dynamicRange.highestTrackableValue shouldBe(6000)
-// defaultMMCounter.dynamicRange.significantValueDigits shouldBe(3)
-// defaultMMCounter.sampleInterval shouldBe(Duration.ofMillis(647))
-//
-// modifiedMMCounter.dynamicRange.lowestDiscernibleValue shouldBe(784)
-// modifiedMMCounter.dynamicRange.highestTrackableValue shouldBe(14785)
-// modifiedMMCounter.dynamicRange.significantValueDigits shouldBe(1)
-// modifiedMMCounter.sampleInterval shouldBe(Duration.ofSeconds(3))
-// }
-// }
-//}