diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2014-07-04 01:51:58 -0300 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2014-07-04 01:51:58 -0300 |
commit | ac2367c8e80bbe6a76f36bd42de9aa9848b0e87b (patch) | |
tree | 15c333bf98222fee71d120585733b963f31ae616 /kamon-statsd | |
parent | 8d46b83a5b1c45cf292f3d4d9af362c2c75fd2dc (diff) | |
download | Kamon-ac2367c8e80bbe6a76f36bd42de9aa9848b0e87b.tar.gz Kamon-ac2367c8e80bbe6a76f36bd42de9aa9848b0e87b.tar.bz2 Kamon-ac2367c8e80bbe6a76f36bd42de9aa9848b0e87b.zip |
+ core: introduce the new kamon.metrics.default-collection-context-buffer-size setting
Diffstat (limited to 'kamon-statsd')
-rw-r--r-- | kamon-statsd/src/test/scala/kamon/statsd/StatsDMetricSenderSpec.scala | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/kamon-statsd/src/test/scala/kamon/statsd/StatsDMetricSenderSpec.scala b/kamon-statsd/src/test/scala/kamon/statsd/StatsDMetricSenderSpec.scala index 19d8a80b..60d52491 100644 --- a/kamon-statsd/src/test/scala/kamon/statsd/StatsDMetricSenderSpec.scala +++ b/kamon-statsd/src/test/scala/kamon/statsd/StatsDMetricSenderSpec.scala @@ -18,8 +18,9 @@ package kamon.statsd import akka.testkit.{ TestKitBase, TestProbe } import akka.actor.{ ActorRef, Props, ActorSystem } +import kamon.Kamon import kamon.metric.instrument.Histogram.Precision -import kamon.metric.instrument.{ Histogram, HdrHistogram } +import kamon.metric.instrument.Histogram import org.scalatest.{ Matchers, WordSpecLike } import kamon.metric._ import akka.io.Udp @@ -32,7 +33,7 @@ class StatsDMetricSenderSpec extends TestKitBase with WordSpecLike with Matchers implicit lazy val system = ActorSystem("statsd-metric-sender-spec", ConfigFactory.parseString("kamon.statsd.max-packet-size = 256 bytes")) - val context = CollectionContext.default + val collectionContext = Kamon(Metrics).buildDefaultCollectionContext "the StatsDMetricSender" should { "flush the metrics data after processing the tick, even if the max-packet-size is not reached" in new UdpListenerFixture { @@ -41,7 +42,7 @@ class StatsDMetricSenderSpec extends TestKitBase with WordSpecLike with Matchers val testRecorder = Histogram(1000L, Precision.Normal, Scale.Unit) testRecorder.record(10L) - val udp = setup(Map(testMetricName -> testRecorder.collect(context))) + val udp = setup(Map(testMetricName -> testRecorder.collect(collectionContext))) val Udp.Send(data, _, _) = udp.expectMsgType[Udp.Send] data.utf8String should be(s"$testMetricKey:10|ms") @@ -55,7 +56,7 @@ class StatsDMetricSenderSpec extends TestKitBase with WordSpecLike with Matchers testRecorder.record(11L) testRecorder.record(12L) - val udp = setup(Map(testMetricName -> testRecorder.collect(context))) + val udp = setup(Map(testMetricName -> testRecorder.collect(collectionContext))) val Udp.Send(data, _, _) = udp.expectMsgType[Udp.Send] data.utf8String should be(s"$testMetricKey:10|ms:11|ms:12|ms") @@ -68,7 +69,7 @@ class StatsDMetricSenderSpec extends TestKitBase with WordSpecLike with Matchers testRecorder.record(10L) testRecorder.record(10L) - val udp = setup(Map(testMetricName -> testRecorder.collect(context))) + val udp = setup(Map(testMetricName -> testRecorder.collect(collectionContext))) val Udp.Send(data, _, _) = udp.expectMsgType[Udp.Send] data.utf8String should be(s"$testMetricKey:10|ms|@0.5") @@ -87,7 +88,7 @@ class StatsDMetricSenderSpec extends TestKitBase with WordSpecLike with Matchers bytes += s":$level|ms".length } - val udp = setup(Map(testMetricName -> testRecorder.collect(context))) + val udp = setup(Map(testMetricName -> testRecorder.collect(collectionContext))) udp.expectMsgType[Udp.Send] // let the first flush pass val Udp.Send(data, _, _) = udp.expectMsgType[Udp.Send] @@ -111,8 +112,8 @@ class StatsDMetricSenderSpec extends TestKitBase with WordSpecLike with Matchers secondTestRecorder.record(21L) val udp = setup(Map( - firstTestMetricName -> firstTestRecorder.collect(context), - secondTestMetricName -> secondTestRecorder.collect(context))) + firstTestMetricName -> firstTestRecorder.collect(collectionContext), + secondTestMetricName -> secondTestRecorder.collect(collectionContext))) val Udp.Send(data, _, _) = udp.expectMsgType[Udp.Send] data.utf8String should be(s"$firstTestMetricKey:10|ms|@0.5:11|ms\n$secondTestMetricKey:20|ms:21|ms") |