diff options
author | Ivan Topolnak <itopolnak@despegar.com> | 2014-04-25 13:17:12 -0300 |
---|---|---|
committer | Ivan Topolnak <itopolnak@despegar.com> | 2014-04-25 13:18:22 -0300 |
commit | a92a45a476dc12ef9c527a3e82b3c5d333e3ec42 (patch) | |
tree | 01a4515e28187ca60ec3f52d83c84601e97c7a58 /kamon-statsd/src/test | |
parent | 2fae6957137b8c2ee62dd50421a9fdc9abeb8907 (diff) | |
download | Kamon-a92a45a476dc12ef9c527a3e82b3c5d333e3ec42.tar.gz Kamon-a92a45a476dc12ef9c527a3e82b3c5d333e3ec42.tar.bz2 Kamon-a92a45a476dc12ef9c527a3e82b3c5d333e3ec42.zip |
! statsd: the max-packet-size setting is now expressed in bytes rather than a plain Int, fixes #27
Diffstat (limited to 'kamon-statsd/src/test')
-rw-r--r-- | kamon-statsd/src/test/scala/kamon/statsd/StatsDMetricSenderSpec.scala | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/kamon-statsd/src/test/scala/kamon/statsd/StatsDMetricSenderSpec.scala b/kamon-statsd/src/test/scala/kamon/statsd/StatsDMetricSenderSpec.scala index 6fdb48f1..8a61d70e 100644 --- a/kamon-statsd/src/test/scala/kamon/statsd/StatsDMetricSenderSpec.scala +++ b/kamon-statsd/src/test/scala/kamon/statsd/StatsDMetricSenderSpec.scala @@ -16,7 +16,7 @@ package kamon.statsd -import akka.testkit.{ TestKit, TestProbe } +import akka.testkit.{ TestKitBase, TestProbe } import akka.actor.{ ActorRef, Props, ActorSystem } import org.scalatest.{ Matchers, WordSpecLike } import kamon.metrics._ @@ -24,10 +24,12 @@ import akka.io.Udp import org.HdrHistogram.HdrRecorder import kamon.metrics.Subscriptions.TickMetricSnapshot import java.lang.management.ManagementFactory -import kamon.Kamon import java.net.InetSocketAddress +import com.typesafe.config.ConfigFactory -class StatsDMetricSenderSpec extends TestKit(ActorSystem("statsd-metric-sender-spec")) with WordSpecLike with Matchers { +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")) "the StatsDMetricSender" should { "flush the metrics data after processing the tick, even if the max-packet-size is not reached" in new UdpListenerFixture { @@ -72,7 +74,7 @@ class StatsDMetricSenderSpec extends TestKit(ActorSystem("statsd-metric-sender-s "flush the packet when the max-packet-size is reached" in new UdpListenerFixture { val testMetricName = "test-metric" val testMetricKey = buildMetricKey(testMetricName) - val testRecorder = HdrRecorder(1000L, 3, Scale.Unit) + val testRecorder = HdrRecorder(testMaxPacketSize, 3, Scale.Unit) var bytes = testMetricKey.length var level = 0 @@ -115,7 +117,7 @@ class StatsDMetricSenderSpec extends TestKit(ActorSystem("statsd-metric-sender-s trait UdpListenerFixture { val localhostName = ManagementFactory.getRuntimeMXBean.getName.split('@')(1) - val testMaxPacketSize = 256 + val testMaxPacketSize = system.settings.config.getBytes("kamon.statsd.max-packet-size") def buildMetricKey(metricName: String): String = s"kamon.$localhostName.test-metric-category.test-group.$metricName" |