setting up zipkin locally with a rails app

325 views
Skip to first unread message

shai rosenfeld

unread,
May 31, 2013, 7:21:54 PM5/31/13
to zipki...@googlegroups.com
Hey, I'm trying to get a setup going with a normal rails app. I've got the zipkin repository cloned, I ran the setup stuff:

./bin/web
./bin/query
./bin/collector

Now I'm trying to add it to my rails app, I add it as the middleware closest to the run rack statement (the middleware breaks at the same place if it's not the closest, which should be fixed). But anyway now I'm getting undefined method zipkin_tracer for the Rails.application as per:

!! Unexpected error while processing request: undefined method `zipkin_tracer' for #<Rails::Application::Configuration:0x007fd22a190790>

For: 

config = app.config.zipkin_tracer

How do I go about adding the right configuration for my rails app? Is there a specific instance/class I should be using? Implementing a specific interface?

I'm on the IRC channel as shaiguitar as well. 

TIA. 

shai rosenfeld

unread,
Jun 3, 2013, 6:09:30 PM6/3/13
to zipki...@googlegroups.com
Bump, filed this over the weekend. What should app.config.zipkin_tracer be implementing?

shai rosenfeld

unread,
Jun 3, 2013, 8:13:09 PM6/3/13
to zipki...@googlegroups.com
Essentially I managed to add this:

class ZipkinTracer
  def initialize
    @random_thing = {}
  end

  def [](arg)
    @random_thing[arg]
  end
end

class Application < Rails::Application
  config.zipkin_tracer = ZipkinTracer.new
end

And things don't bomb out, so clearly that's the outer interface, but how do I actually get data into the local zipkin stuff I have running? What is that zipkin_tracer supposed to do?

Brian Degenhardt

unread,
Jun 3, 2013, 8:24:42 PM6/3/13
to zipkin-user
Sorry, as discussed on irc, my ruby knowledge is quite thin.  The tracer is supposed to log stuff to scribe and then be forewarded to zipkin-collector:


If you're not running scribe you can point your traced code directly at the collector's host/port.


--
 
---
You received this message because you are subscribed to the Google Groups "zipkin-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zipkin-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

shai rosenfeld

unread,
Jun 14, 2013, 7:51:01 PM6/14/13
to zipki...@googlegroups.com
Just for doc's sake in this post:

+    zipkin_tracer_info = HashWithIndifferentAccess.new
+    # no scribe...so straight to collector! if you have scribe, it should be port 1463 instead?
+    zipkin_tracer_info.merge!({service_name: 'your_app', service_port: 9410, sample_rate: 1})
+    config.zipkin_tracer = zipkin_tracer_info

shai rosenfeld

unread,
Jun 20, 2013, 1:50:13 PM6/20/13
to zipki...@googlegroups.com
If you don't use scribe and want to forward straight to the collector, use this configuration: 

config.zipkin_tracer = {service_name: 'awsm', service_port: 9410, sample_rate: 1, scribe_server: "127.0.0.1:9410"}
Reply all
Reply to author
Forward
0 new messages