-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add http and kafka transports to zipkin-tracer #465
Comments
cc @kristofa I know y'all at SoundCloud are using zipkin, though possibly more interested in kafka |
@adriancole seems reasonable. It'd probably need a bit of work because finagle-zipkin brings in the thrift tracer via service loading. To do it in a backwards compatible manner, I think that implies moving most of everything in finagle-zipkin into a finagle-zipkin-core and then leaving the service loader in finagle-zipkin. Then you can add a new module finagle-zipkin-http that depends on finagle-zipkin-core and finagle-http and adds this tracer. But maybe I'm jumping to conclusions with regards to what you are thinking from the service loader aspect. |
Thanks for having a look, Kevin.
so addressing service loader might undo the current hack of
DefaultTracer.self = HttpZipkinTracer or similar, I guess.
One thing about the http tracer is that unlike scribe, there's no
sensible localhost default.
If using service loader, it would need to I suppose resolve a name
from discovery, else they'd still need to explicitly configure it? Or
maybe I'm missing something. Let's bear in mind that kafka transport
will likely follow.
|
Ok. So if since it needs configuration, this can be done manually as you mentioned — I would defer to you and your users on how you'd prefer to do it. I suspect the former is simpler for most though. Kafka sounds like it would be similar, there'd be a new finagle-zipkin-kafka module, and it could be configured in whatever fashion is desired. |
Another approach is to use service loading plus flags (e.g. System
|
@adriancole Thanks for taking this up and moving http and kafka support in Finagle! At SoundCloud we have wrapper classes for building Finagle servers and clients. These thin wrappers deal with configuration like settings up the tracer. So instead of relying on service loading or overriding the DefaultTracer we explicitly set the tracer we use like this:
|
|
I think a Re @kristofa's comments — explicit configuration is nice. I think @adriancole is probably also correct that it won't catch everything, but I think it practice its close to everything. |
ps there's some related work about abstracting the reporting function generically here. This would apply to kafka, too, for example: https://github.com/openzipkin/zipkin-java/issues/181 |
FYI, if someone wants to make an interim kafka subtype of RawZipkinTracer, it would look something like this.. --snip--
val topic = "zipkin"
val kafka = "localhost:9092"
val props: Properties = new Properties
props.put("bootstrap.servers", kafka)
props.put("metadata.broker.list", kafka)
props.put("serializer.class", "kafka.serializer.DefaultEncoder")
props.put("producer.type", "sync")
props.put("request.required.acks", "1")
val producer = new Producer[Array[Byte], Array[Byte]](new ProducerConfig(props))
override def logSpans(spans: Seq[Span]): Future[Unit] = {
// Write spans to a thrift list used as a keyed message body
val zipkinSpans = try {
val transport = new TMemoryBuffer(0)
val oproto = new TBinaryProtocol(transport)
oproto.writeListBegin(new TList(TType.STRUCT, spans.size))
spans.map(_.toThrift).foreach(_.write(oproto))
oproto.writeListEnd()
transport.getArray
} catch {
case NonFatal(e) => errorReceiver.counter(e.getClass.getName).incr(); return Future.Unit
}
// send the message off, incrementing counters as needed
try {
producer.send(new KeyedMessage(topic, zipkinSpans))
okCounter.incr()
} catch {
case NonFatal(e) => errorReceiver.counter(e.getClass.getName).incr();
}
return Future.Unit
} |
fyi I plan to start on this tomorrow |
@kevinoliver so here's what I am thinking, which I think is exactly what you said a while back: finagle-zipkin remains the same, basically it holds what we might otherwise call finagle-zipkin-scribe
finagle-zipkin-http and -kafka hold reporters for each of the transport, as well global flags to control the endpoints, and service loader definitions to enable them |
Hi guys, I started some work on this over the weekend. I just synced with @adriancole and I'll take this over. |
Problem Address issue #465 (Add http and kafka transports to zipkin-tracer). Zipkin can receive traces via Kafka, HTTP and Scribe. Some Finagle users (including Quizup) already using Kafka are reluctant to introduce Scribe into their stack as it is no longer maintained. So the purpose of this PR is to support Kafka as a transport for Zipkin traces, as well as structuring the code such that it allows other transports to be added (like HTTP). Solution Extract most of finagle-zipkin into finagle-zipkin-core, leaving finagle-zipkin with only scribe specific stuff (with no api breaking changes to finagle-zipkin of course). Signed-off-by: Kevin Oliver <koliver@twitter.com> RB_ID=840494 TBR=true
Looks like the first wave of this work arrived in master. Thanks for the progress folks! |
zipkin-finagle has all three transports implemented. please try it out! https://github.com/openzipkin/zipkin-finagle |
Many people aren't running scribe and don't want to run scribe. Zipkin used to only work with scribe, but it now works with http and kafka.
I've pasted a copy of a patched http raw zipkin tracer below.. Is something like this possible to add to Finagle directly?
https://github.com/openzipkin/zipkin/blob/scala/zipkin-web/src/main/scala/com/twitter/finagle/zipkin/thrift/HttpZipkinTracer.scala
https://github.com/openzipkin/zipkin/blob/scala/zipkin-web/src/test/scala/com/twitter/zipkin/web/HttpZipkinTracerTest.scala
The text was updated successfully, but these errors were encountered: