diff options
author | Diego <diegolparra@gmail.com> | 2014-04-02 17:58:32 -0300 |
---|---|---|
committer | Diego <diegolparra@gmail.com> | 2014-04-02 20:12:39 -0300 |
commit | 733e5dcd98e1e8c83a4b315fdb6eca3fb761ecc7 (patch) | |
tree | e0bfff6c9b304cad8cf5a464d68982e330c028f0 /kamon-statsd/src/main/scala/kamon/statsd/client | |
parent | 5da2099182b4b2b8678ed97fcaa6d74f02bb5544 (diff) | |
download | Kamon-733e5dcd98e1e8c83a4b315fdb6eca3fb761ecc7.tar.gz Kamon-733e5dcd98e1e8c83a4b315fdb6eca3fb761ecc7.tar.bz2 Kamon-733e5dcd98e1e8c83a4b315fdb6eca3fb761ecc7.zip |
simple refactor
Diffstat (limited to 'kamon-statsd/src/main/scala/kamon/statsd/client')
-rw-r--r-- | kamon-statsd/src/main/scala/kamon/statsd/client/StatsdMetricsSender.scala | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/kamon-statsd/src/main/scala/kamon/statsd/client/StatsdMetricsSender.scala b/kamon-statsd/src/main/scala/kamon/statsd/client/StatsdMetricsSender.scala index 8ee08420..d9173e45 100644 --- a/kamon-statsd/src/main/scala/kamon/statsd/client/StatsdMetricsSender.scala +++ b/kamon-statsd/src/main/scala/kamon/statsd/client/StatsdMetricsSender.scala @@ -22,10 +22,8 @@ import java.net.InetSocketAddress import akka.util.ByteString class StatsdMetricsSender(statPrefix:String, remote: InetSocketAddress) extends Actor with ActorLogging { - import context.system - import StatsdMetricsSender._ - import StatsDProtocol._ + import context.system IO(Udp) ! Udp.SimpleSender @@ -43,9 +41,13 @@ class StatsdMetricsSender(statPrefix:String, remote: InetSocketAddress) extends } object StatsdMetricsSender { - import StatsDProtocol._ - def props(statPrefix:String, remote: InetSocketAddress): Props = Props(new StatsdMetricsSender(statPrefix, remote)) + sealed trait StatsdMetric + case class Counter(key: String, value: Long = 1, suffix:String = "c", samplingRate: Double = 1.0) extends StatsdMetric + case class Timing(key: String, millis: Long, suffix:String = "ms", samplingRate: Double = 1.0) extends StatsdMetric + case class Gauge(key: String, value: Long, suffix:String = "g", samplingRate: Double = 1.0) extends StatsdMetric + + def props(statPrefix:String, remote: InetSocketAddress): Props = Props(new StatsdMetricsSender(statPrefix, remote)) def toByteString(statPrefix:String, metric:StatsdMetric) : ByteString = metric match { case Counter(key, value, suffix, samplingRate) => statFor(statPrefix, key, value, suffix, samplingRate) @@ -65,13 +67,4 @@ object StatsdMetricsSender { case _ => ByteString(s"${statPrefix}.${key}:${value}|${suffix}|@$samplingRate") } } -} - - -object StatsDProtocol { - - sealed trait StatsdMetric - case class Counter(key: String, value: Long = 1, suffix:String = "c", samplingRate: Double = 1.0) extends StatsdMetric - case class Timing(key: String, millis: Long, suffix:String = "ms", samplingRate: Double = 1.0) extends StatsdMetric - case class Gauge(key: String, value: Long, suffix:String = "g", samplingRate: Double = 1.0) extends StatsdMetric -} +}
\ No newline at end of file |