Skip to content
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

local tracing example #6

Open
cli99 opened this issue Jul 19, 2017 · 2 comments
Open

local tracing example #6

cli99 opened this issue Jul 19, 2017 · 2 comments

Comments

@cli99
Copy link

cli99 commented Jul 19, 2017

Can you give a complete local tracing example?
I have the following test code. It compiles and runs but my zipkin server does not capture anything.

int main(int argc, char **argv)
{
  zipkin_http_conf_t conf = zipkin_http_conf_new("http://localhost:9411/api/v1/spans");
  zipkin_collector_t collector = zipkin_http_collector_new(conf);
  zipkin_tracer_t tracer = zipkin_tracer_new(collector);

  zipkin_span_t span = zipkin_span_new(tracer, "encode", NULL);
  for (int i=3; i>0; --i) {
    std::cout << i << std::endl;
    std::this_thread::sleep_for (std::chrono::seconds(1));
  }
  zipkin_span_submit(span);
  return 0;
}

I have zipkin server running as docker run -d -p 9411:9411 openzipkin/zipkin
Thanks.

@flier
Copy link
Owner

flier commented Jul 21, 2017

Most of collector will cache the submitted spans in a local queue for better performance, it means when you exit your program, you may need wait a while for those pending messages with zipkin_collector_shutdown

void zipkin_collector_shutdown(zipkin_collector_t collector, size_t timeout_ms);

You could check simple_proxy example for more detail.

Anyway, I will update the document for this later.

@nicksbyman
Copy link
Contributor

nicksbyman commented Jul 24, 2017

In addition to what @flier mentions @cli99, you must give the span a service name for it to appear in the UI via the zipkin_span_annotate call, which is missing from your code snippet. @flier I think this would be good to add to the docs. Something just saying that while the server will receive spans without a service name annotation, they will not be easily visible in the UI without it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants