Skip to content

Instantly share code, notes, and snippets.

@jamescway
Created December 4, 2014 16:23
Show Gist options
  • Save jamescway/f7c8a9e7cb1ce4c8458b to your computer and use it in GitHub Desktop.
Save jamescway/f7c8a9e7cb1ce4c8458b to your computer and use it in GitHub Desktop.
kafkaReceiver put into main.scala
import com.twitter.zipkin.gen.{Span => ThriftSpan}
import com.twitter.finagle.stats.StatsReceiver
import com.twitter.server.TwitterServer
import com.twitter.util.{Await, Future}
import com.twitter.zipkin.cassandra.CassieSpanStoreFactory
import com.twitter.zipkin.collector.{SpanReceiver, ZipkinQueuedCollectorFactory}
import com.twitter.zipkin.common._
import com.twitter.zipkin.receiver.kafka.KafkaSpanReceiverFactory
import com.twitter.zipkin.storage.WriteSpanStore
import com.twitter.zipkin.zookeeper.ZooKeeperClientFactory
import kafka.serializer.Decoder
// JW: added this
import com.twitter.zipkin.receiver.kafka.MyDecoder
object ZipkinKafkaCollectorServer extends TwitterServer
with ZipkinQueuedCollectorFactory
with CassieSpanStoreFactory
with ZooKeeperClientFactory
with KafkaSpanReceiverFactory
{
def newReceiver(receive: Seq[ThriftSpan] => Future[Unit], stats: StatsReceiver): SpanReceiver =
newKafkaSpanReceiver(receive, stats.scope("kafkaSpanReceiver"), new MyDecoder())
def newSpanStore(stats: StatsReceiver): WriteSpanStore =
newCassandraStore(stats.scope("cassie"))
def main() {
val collector = newCollector(statsReceiver)
onExit { collector.close() }
Await.ready(collector)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment