Skip to content

Instantly share code, notes, and snippets.

@jamescway
Last active August 29, 2015 14:26
Show Gist options
  • Save jamescway/14f798685e35a15cb489 to your computer and use it in GitHub Desktop.
Save jamescway/14f798685e35a15cb489 to your computer and use it in GitHub Desktop.
Zipkin kafka usage change main.scala
import com.twitter.zipkin.thriftscala.{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
import com.twitter.zipkin.receiver.kafka.SpanDecoder
//ZipkinKafkaCollectorServer
object Main extends TwitterServer //because build.gradle expects to see an object named Main
with ZipkinQueuedCollectorFactory
with CassieSpanStoreFactory
with ZooKeeperClientFactory
with KafkaSpanReceiverFactory
{
def newReceiver(receive: Seq[ThriftSpan] => Future[Unit], stats: StatsReceiver): SpanReceiver = {
newKafkaSpanReceiver(receive, stats.scope("kafkaSpanReceiver"), Some(new SpanDecoder()), new SpanDecoder())
}
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