m3dev / octoparts

Octoparts, the backend services aggregator
https://m3dev.github.io/octoparts/
Other
152 stars 18 forks source link

Vagrant Zipkin #160

Closed xevix closed 9 years ago

xevix commented 9 years ago

This sets up Zipkin 1.1.0 in the Vagrant Box with persistent SQLite DBs for the collector and query services, and exposes zipkin-web on port 8085. It seems Zipkin 1.1.0 doesn't run on Java 8, so I also added a Java 7 role which is nearly identical to Java 8.

In order to show Zipkin in action though, we'll need to either add traces that are over the threshold it needs, or lower its threshold for collecting traces. Also, I'm not sure if we need to add Span information somehow on the sample echo endpoint in the "getting started" guide.

xevix commented 9 years ago

@lloydmeta Ok, fixed tracing to work. Is there a simple way to add a child span for the sample echo endpoint in the getting started guide, or would that require some code? Perhaps some header params or something that get picked up by Octoparts?

lloydmeta commented 9 years ago

Firstly, great work :) :+1: This goes a long way to make it a lot easier for newcomers to understand the merits of Zipkin + Octoparts :)

I'm afraid getting the echo endpoint in the guide to send child spans is impossible, since the echo service (third party service hosted at jsontest.com) will not send traces to the Zipkin collector service on your local Vagrant VM.

That said, if you send Zipkin headers when making your request to Octoparts, it could make it look like there is a parent span (might show up with an empty name in the Zipkin UI though, since one prolly won't bother actually submitting a parent span) and the child span will be the Octoparts portion of the request. See here for the Zipkin-headers expected (I think parentSpanId is not required), but note that that they need to be hex-encoded long strings.

Also, I believe there are Zipkin extensions for Firefox/Chrome which will add auto-generated parent-trace-and-span ids to HTTP requests to make the above less painful as long as you make your requests through your browser. I believe @mauhiz was able to install something like this for Firefox, but I'm not sure it was this exactly.

xevix commented 9 years ago

Yeah, my thoughts were to add the params, hex-encoded, to the guide for a user to copy+paste in there. In particular, after they finish trying out the base endpoint, maybe tell them if they want to try Zipkin, add these header params, and try again or so. Thanks for the link, I'll give those params a shot.

Another idea would be to add a small test endpoint similar to echo into Octoparts itself with the proper span info perhaps.

I think asking people to install a browser extension might be further than some people are willing to trust or do, so hopefully we can take the path of least resistance here (whatever it ends up being).

lloydmeta commented 9 years ago

Yeah, my thoughts were to add the params, hex-encoded, to the guide for a user to copy+paste in there. In particular, after they finish trying out the base endpoint, maybe tell them if they want to try Zipkin, add these header params, and try again or so. Thanks for the link, I'll give those params a shot.

Good idea. Then again, Zipkin tracing already works as-is since Octoparts will generate a parent trace if there is no tracing info sent. As a result, maybe it should be a "by-the-way" kind of thing in case they want to see what it's like to have a parent trace.

Another idea would be to add a small test endpoint similar to echo into Octoparts itself with the proper span info perhaps.

I would rather we add a separate sample-echo app in the project to do this. People can run that separate from Octoparts if they want to simulate a more realistic Zipkin tracing experience; having something like this in Octoparts server proper seems like too much cruft for the purpose of demo'ing a niche scenario.

In any case, this PR seems to be fairly well contained and is ready to be merged from what I can tell. If you need to do additional cleanup and testing, take your time, but I'll merge it once the WIP label is removed.

xevix commented 9 years ago

@lloydmeta Yeah, it was mainly so they could see a span labeled "echo" so they can clearly see the performance breakup. I guess we can also just point them to the example screenshot for what that might look like with "test2" at the bottom http://m3dev.github.io/octoparts/img/zipkin-dashboard.png.

Right, the idea would be to have a separate running mini-app. What I meant by into Octoparts was within this repo, although I guess we could also put it in its own repo. Either way, perhaps the above screenshot will be enough.

Ok, going to remove the WIP.

lloydmeta commented 9 years ago

Ugh, Oracle is giving me 500s when trying to download JDKs (looks like there's a temporary redirect that's faulty). Will try verifying again later.

xevix commented 9 years ago

@lloydmeta Ah, strange. I just tried a fresh vagrant provision and it seems to download fine now. I did notice something weird about the web version though. If you try to download the .tar.gz from your browser, it tries to save a .gz file instead, but it works fine from within Ansible.

mauhiz commented 9 years ago

@lloydmeta I think there is only 1 Zipkin plugin. What it does is :

On Sat, Aug 1, 2015 at 9:45 PM, Alejandro Wainzinger < notifications@github.com> wrote:

@lloydmeta https://github.com/lloydmeta Ah, strange. I just tried a fresh vagrant provision and it seems to download fine now. I did notice something weird about the web version though. If you try to download the .tar.gz from your browser, it tries to save a .gz file instead, but it works fine from within Ansible.

— Reply to this email directly or view it on GitHub https://github.com/m3dev/octoparts/pull/160#issuecomment-126911404.

lloydmeta commented 9 years ago

@mauhiz thanks for the info; was it hard to install? I think it worked quite well from what you showed me.

@xevix yeah dunno what to say, it works now ! I hope it's not a sign that Oracle is trying to stop our little wget + cookie method of installing JDKs to the VM.

In any case, I just verified that this PR works fine :) Cheers. Merging now