diff options
Diffstat (limited to 'kamon-core/src/test/scala/kamon/metric')
8 files changed, 55 insertions, 40 deletions
diff --git a/kamon-core/src/test/scala/kamon/metric/MetricScaleDecoratorSpec.scala b/kamon-core/src/test/scala/kamon/metric/MetricScaleDecoratorSpec.scala index 902102cd..d3d0f4fb 100644 --- a/kamon-core/src/test/scala/kamon/metric/MetricScaleDecoratorSpec.scala +++ b/kamon-core/src/test/scala/kamon/metric/MetricScaleDecoratorSpec.scala @@ -18,7 +18,7 @@ package kamon.metric import kamon.Kamon import kamon.metric.SubscriptionsDispatcher.TickMetricSnapshot -import kamon.metric.instrument.{ InstrumentFactory, Memory, Time, UnitOfMeasurement } +import kamon.metric.instrument.{InstrumentFactory, Memory, Time, UnitOfMeasurement} import kamon.testkit.BaseKamonSpec import kamon.util.MilliTimestamp import org.scalatest.OptionValues._ @@ -28,7 +28,8 @@ class MetricScaleDecoratorSpec extends BaseKamonSpec("metrics-scale-decorator-sp "receives a snapshot" which { val scaleDecorator = system.actorOf(MetricScaleDecorator.props( - Some(Time.Milliseconds), Some(Memory.KiloBytes), testActor)) + Some(Time.Milliseconds), Some(Memory.KiloBytes), testActor + )) "is empty" should { "do nothing for empty snapshots" in { scaleDecorator ! emptySnapshot @@ -94,7 +95,8 @@ trait SnapshotFixtures { recorder.kbyteMemory.increment(100L) val nonEmptySnapshot = TickMetricSnapshot(new MilliTimestamp(1000), new MilliTimestamp(2000), Map( - (testEntity -> recorder.collect(collectionContext)))) + (testEntity → recorder.collect(collectionContext)) + )) } diff --git a/kamon-core/src/test/scala/kamon/metric/SubscriptionsProtocolSpec.scala b/kamon-core/src/test/scala/kamon/metric/SubscriptionsProtocolSpec.scala index b8131f6e..36cc62c3 100644 --- a/kamon-core/src/test/scala/kamon/metric/SubscriptionsProtocolSpec.scala +++ b/kamon-core/src/test/scala/kamon/metric/SubscriptionsProtocolSpec.scala @@ -17,7 +17,7 @@ package kamon.metric import akka.actor._ -import akka.testkit.{ TestProbe, ImplicitSender } +import akka.testkit.{TestProbe, ImplicitSender} import com.typesafe.config.ConfigFactory import kamon.Kamon import kamon.metric.SubscriptionsDispatcher.TickMetricSnapshot @@ -31,10 +31,11 @@ class SubscriptionsProtocolSpec extends BaseKamonSpec("subscriptions-protocol-sp |kamon.metric { | tick-interval = 1 hour |} - """.stripMargin) + """.stripMargin + ) lazy val metricsModule = Kamon.metrics - import metricsModule.{ entity, subscribe, unsubscribe } + import metricsModule.{entity, subscribe, unsubscribe} "the Subscriptions messaging protocol" should { "allow subscribing for a single tick" in { diff --git a/kamon-core/src/test/scala/kamon/metric/TickMetricSnapshotBufferSpec.scala b/kamon-core/src/test/scala/kamon/metric/TickMetricSnapshotBufferSpec.scala index 97bf0e2c..6172a9e0 100644 --- a/kamon-core/src/test/scala/kamon/metric/TickMetricSnapshotBufferSpec.scala +++ b/kamon-core/src/test/scala/kamon/metric/TickMetricSnapshotBufferSpec.scala @@ -65,7 +65,8 @@ class TickMetricSnapshotBufferSpec extends BaseKamonSpec("trace-metrics-spec") w MutableRecord(10, 3), MutableRecord(20, 1), MutableRecord(30, 1), - MutableRecord(300, 1)) + MutableRecord(300, 1) + ) } } @@ -83,12 +84,14 @@ class TickMetricSnapshotBufferSpec extends BaseKamonSpec("trace-metrics-spec") w traceRecorder.elapsedTime.record(20L) traceRecorder.elapsedTime.record(30L) val firstNonEmpty = TickMetricSnapshot(new MilliTimestamp(1000), new MilliTimestamp(2000), Map( - (testTraceIdentity -> traceRecorder.collect(collectionContext)))) + (testTraceIdentity → traceRecorder.collect(collectionContext)) + )) traceRecorder.elapsedTime.record(10L) traceRecorder.elapsedTime.record(10L) traceRecorder.elapsedTime.record(300L) val secondNonEmpty = TickMetricSnapshot(new MilliTimestamp(1000), new MilliTimestamp(2000), Map( - (testTraceIdentity -> traceRecorder.collect(collectionContext)))) + (testTraceIdentity → traceRecorder.collect(collectionContext)) + )) } } diff --git a/kamon-core/src/test/scala/kamon/metric/TraceMetricsSpec.scala b/kamon-core/src/test/scala/kamon/metric/TraceMetricsSpec.scala index 7678991e..4c44dc07 100644 --- a/kamon-core/src/test/scala/kamon/metric/TraceMetricsSpec.scala +++ b/kamon-core/src/test/scala/kamon/metric/TraceMetricsSpec.scala @@ -47,9 +47,10 @@ class TraceMetricsSpec extends BaseKamonSpec("trace-metrics-spec") with Implicit val snapshot = takeSnapshotOf("test-segment", "trace-segment", tags = Map( - "trace" -> "trace-with-segments", - "category" -> "test-category", - "library" -> "test-library")) + "trace" → "trace-with-segments", + "category" → "test-category", + "library" → "test-library" + )) snapshot.histogram("elapsed-time").get.numberOfMeasurements should be(1) } @@ -69,18 +70,20 @@ class TraceMetricsSpec extends BaseKamonSpec("trace-metrics-spec") with Implicit takeSnapshotOf("test-segment", "trace-segment", tags = Map( - "trace" -> "closing-segment-after-trace", - "category" -> "test-category", - "library" -> "test-library")) + "trace" → "closing-segment-after-trace", + "category" → "test-category", + "library" → "test-library" + )) } segment.finish() val afterFinishSegmentSnapshot = takeSnapshotOf("test-segment", "trace-segment", tags = Map( - "trace" -> "closing-segment-after-trace", - "category" -> "test-category", - "library" -> "test-library")) + "trace" → "closing-segment-after-trace", + "category" → "test-category", + "library" → "test-library" + )) afterFinishSegmentSnapshot.histogram("elapsed-time").get.numberOfMeasurements should be(1) } @@ -106,9 +109,10 @@ class TraceMetricsSpec extends BaseKamonSpec("trace-metrics-spec") with Implicit val snapshot = takeSnapshotOf("test-segment-with-error", "trace-segment", tags = Map( - "trace" -> "trace-with-segments", - "category" -> "test-category", - "library" -> "test-library")) + "trace" → "trace-with-segments", + "category" → "test-category", + "library" → "test-library" + )) snapshot.histogram("elapsed-time").get.numberOfMeasurements should be(1) snapshot.counter("errors").get.count should be(1) diff --git a/kamon-core/src/test/scala/kamon/metric/instrument/CounterSpec.scala b/kamon-core/src/test/scala/kamon/metric/instrument/CounterSpec.scala index 850200d4..d5d651e5 100644 --- a/kamon-core/src/test/scala/kamon/metric/instrument/CounterSpec.scala +++ b/kamon-core/src/test/scala/kamon/metric/instrument/CounterSpec.scala @@ -18,7 +18,7 @@ package kamon.metric.instrument import java.nio.LongBuffer -import org.scalatest.{ Matchers, WordSpec } +import org.scalatest.{Matchers, WordSpec} class CounterSpec extends WordSpec with Matchers { diff --git a/kamon-core/src/test/scala/kamon/metric/instrument/HistogramSpec.scala b/kamon-core/src/test/scala/kamon/metric/instrument/HistogramSpec.scala index dd60fee1..9551c6ea 100644 --- a/kamon-core/src/test/scala/kamon/metric/instrument/HistogramSpec.scala +++ b/kamon-core/src/test/scala/kamon/metric/instrument/HistogramSpec.scala @@ -19,7 +19,7 @@ package kamon.metric.instrument import java.nio.LongBuffer import kamon.metric.instrument.Histogram.DynamicRange -import org.scalatest.{ Matchers, WordSpec } +import org.scalatest.{Matchers, WordSpec} import scala.util.Random @@ -62,12 +62,12 @@ class HistogramSpec extends WordSpec with Matchers { snapshot.sum should be(41300) snapshot.numberOfMeasurements should be(203) - val records = snapshot.recordsIterator.map(r ⇒ r.level -> r.count).toSeq + val records = snapshot.recordsIterator.map(r ⇒ r.level → r.count).toSeq records.size should be(4) - records(0) should be(100 -> 1) - records(1) should be(200 -> 200) - records(2) should be(300 -> 1) - records(3) should be(900 -> 1) + records(0) should be(100 → 1) + records(1) should be(200 → 200) + records(2) should be(300 → 1) + records(3) should be(900 → 1) } "can be scaled" in new HistogramFixture { @@ -86,12 +86,12 @@ class HistogramSpec extends WordSpec with Matchers { snapshot.sum should be(41300000) snapshot.numberOfMeasurements should be(203) - val records = snapshot.recordsIterator.map(r ⇒ r.level -> r.count).toSeq + val records = snapshot.recordsIterator.map(r ⇒ r.level → r.count).toSeq records.size should be(4) - records(0) should be(100000 -> 1) - records(1) should be(200000 -> 200) - records(2) should be(300000 -> 1) - records(3) should be(900000 -> 1) + records(0) should be(100000 → 1) + records(1) should be(200000 → 200) + records(2) should be(300000 → 1) + records(3) should be(900000 → 1) } "can be merged with another snapshot" in new MultipleHistogramFixture { diff --git a/kamon-core/src/test/scala/kamon/metric/instrument/MinMaxCounterSpec.scala b/kamon-core/src/test/scala/kamon/metric/instrument/MinMaxCounterSpec.scala index 7acfc229..d007d4cd 100644 --- a/kamon-core/src/test/scala/kamon/metric/instrument/MinMaxCounterSpec.scala +++ b/kamon-core/src/test/scala/kamon/metric/instrument/MinMaxCounterSpec.scala @@ -20,7 +20,7 @@ import java.nio.LongBuffer import akka.actor._ import akka.testkit.TestProbe import kamon.Kamon -import kamon.metric.instrument.Histogram.{ DynamicRange, MutableRecord } +import kamon.metric.instrument.Histogram.{DynamicRange, MutableRecord} import kamon.testkit.BaseKamonSpec import scala.concurrent.duration._ @@ -38,7 +38,8 @@ class MinMaxCounterSpec extends BaseKamonSpec("min-max-counter-spec") { snapshot.max should be(5) snapshot.recordsIterator.toStream should contain allOf ( MutableRecord(0, 1), // min - MutableRecord(5, 2)) // max and current + MutableRecord(5, 2) + ) // max and current } "track descending tendencies" in new MinMaxCounterFixture { @@ -53,7 +54,8 @@ class MinMaxCounterSpec extends BaseKamonSpec("min-max-counter-spec") { snapshot.max should be(5) snapshot.recordsIterator.toStream should contain allOf ( MutableRecord(0, 2), // min and current - MutableRecord(5, 1)) // max + MutableRecord(5, 1) + ) // max } "reset the min and max to the current value after taking a snapshot" in new MinMaxCounterFixture { @@ -67,14 +69,16 @@ class MinMaxCounterSpec extends BaseKamonSpec("min-max-counter-spec") { firstSnapshot.recordsIterator.toStream should contain allOf ( MutableRecord(0, 1), // min MutableRecord(2, 1), // current - MutableRecord(5, 1)) // max + MutableRecord(5, 1) + ) // max val secondSnapshot = collectCounterSnapshot() secondSnapshot.min should be(2) secondSnapshot.max should be(2) secondSnapshot.recordsIterator.toStream should contain( - MutableRecord(2, 3)) // min, max and current + MutableRecord(2, 3) + ) // min, max and current } "report zero as the min and current values if the current value fell bellow zero" in new MinMaxCounterFixture { @@ -85,7 +89,8 @@ class MinMaxCounterSpec extends BaseKamonSpec("min-max-counter-spec") { snapshot.min should be(0) snapshot.max should be(0) snapshot.recordsIterator.toStream should contain( - MutableRecord(0, 3)) // min, max and current (even while current really is -3 + MutableRecord(0, 3) + ) // min, max and current (even while current really is -3 } "never record values bellow zero in very busy situations" in new MinMaxCounterFixture { diff --git a/kamon-core/src/test/scala/kamon/metric/instrument/UnitOfMeasurementSpec.scala b/kamon-core/src/test/scala/kamon/metric/instrument/UnitOfMeasurementSpec.scala index 10604fe5..7133579e 100644 --- a/kamon-core/src/test/scala/kamon/metric/instrument/UnitOfMeasurementSpec.scala +++ b/kamon-core/src/test/scala/kamon/metric/instrument/UnitOfMeasurementSpec.scala @@ -17,7 +17,7 @@ package kamon.metric.instrument import kamon.metric.instrument.UnitOfMeasurement.Unknown -import org.scalatest.{ Matchers, WordSpec } +import org.scalatest.{Matchers, WordSpec} class UnitOfMeasurementSpec extends WordSpec with Matchers { |