Skip to content
Snippets Groups Projects
Commit 1360f62d authored by Russell Cardullo's avatar Russell Cardullo
Browse files

Cleanup GraphiteSink.scala based on feedback

* Reorder imports according to the style guide
* Consistently use propertyToOption in all places
parent ef85a51f
No related branches found
No related tags found
No related merge requests found
......@@ -17,13 +17,13 @@
package org.apache.spark.metrics.sink
import com.codahale.metrics.MetricRegistry
import com.codahale.metrics.graphite.{GraphiteReporter, Graphite}
import java.util.Properties
import java.util.concurrent.TimeUnit
import java.net.InetSocketAddress
import com.codahale.metrics.MetricRegistry
import com.codahale.metrics.graphite.{GraphiteReporter, Graphite}
import org.apache.spark.metrics.MetricsSystem
class GraphiteSink(val property: Properties, val registry: MetricRegistry) extends Sink {
......@@ -50,12 +50,12 @@ class GraphiteSink(val property: Properties, val registry: MetricRegistry) exten
val host = propertyToOption(GRAPHITE_KEY_HOST).get
val port = propertyToOption(GRAPHITE_KEY_PORT).get.toInt
val pollPeriod = Option(property.getProperty(GRAPHITE_KEY_PERIOD)) match {
val pollPeriod = propertyToOption(GRAPHITE_KEY_PERIOD) match {
case Some(s) => s.toInt
case None => GRAPHITE_DEFAULT_PERIOD
}
val pollUnit = Option(property.getProperty(GRAPHITE_KEY_UNIT)) match {
val pollUnit = propertyToOption(GRAPHITE_KEY_UNIT) match {
case Some(s) => TimeUnit.valueOf(s.toUpperCase())
case None => TimeUnit.valueOf(GRAPHITE_DEFAULT_UNIT)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment