diff --git a/build.sbt b/build.sbt index 7599167..c3af8e7 100644 --- a/build.sbt +++ b/build.sbt @@ -58,8 +58,7 @@ libraryDependencies ++= Seq( "com.ircclouds.irc" % "irc-api" % "1.0-0014", "org.apache.kafka" % "kafka-clients" % "2.2.0", "ch.qos.logback" % "logback-core" % "1.1.2", - "ch.qos.logback" % "logback-classic" % "1.1.2", - "io.imply" %% "hostbook" % "0.2" + "ch.qos.logback" % "logback-classic" % "1.1.2" ) lazy val root = project.in(file(".")).enablePlugins(JavaAppPackaging) diff --git a/src/main/scala/io/imply/wikiticker/ConsoleTicker.scala b/src/main/scala/io/imply/wikiticker/ConsoleTicker.scala index c8ae17c..99d095b 100644 --- a/src/main/scala/io/imply/wikiticker/ConsoleTicker.scala +++ b/src/main/scala/io/imply/wikiticker/ConsoleTicker.scala @@ -23,12 +23,10 @@ import com.metamx.common.scala.Logging import com.metamx.common.scala.lifecycle._ import com.metamx.common.scala.untyped.Dict import com.twitter.app.Flags -import io.imply.hostbook.GeoLookup import java.io.File object ConsoleTicker extends Logging { - private val geoDb = GeoLookup.fromFreeDownloadableCityDatabase(new File(Files.createTempDir(), "geodb")) private val ipPattern = "(\\d+.\\d+.\\d+.\\d+)".r private var messageCounter = 0 @@ -51,8 +49,7 @@ object ConsoleTicker extends Logging val listener = new MessageListener { override def process(message: Message) = { - writer.write(Jackson.generate(withGeo(message.toMap))) - + writer.write(Jackson.generate(message.toMap)) messageCounter += 1 if (messageCounter % 100 == 0) { log.info(s"Processed [${messageCounter}] messages") @@ -143,21 +140,4 @@ object ConsoleTicker extends Logging } } - def withGeo(map: Dict): Dict = { - map ++ (map("user").asInstanceOf[String] match { - case ipPattern(ip) => { - val result = geoDb.lookup(ip) - Dict( - "isAnonymous" -> true, - "cityName" -> result.cityName.orNull, - "countryIsoCode" -> result.countryIsoCode.orNull, - "countryName" -> result.countryName.orNull, - "metroCode" -> result.metroCode.orNull, - "regionIsoCode" -> result.regionIsoCode.orNull, - "regionName" -> result.regionName.orNull - ) - } - case _ => Dict("isAnonymous" -> false) - }) - } }