0

I'm using the camel-zipkin component to trace a request that flows between two different services:

service-a: Camel application running on Spring Boot, acting as a simple HTTP proxy (for the purposes of this proof of concept). Zipkin support provided by the camel-zipkin module. Route:

    from("servlet:service-a?matchOnUriPrefix=true")
      .routeId("service-a-to-b")
      .delay(2000)
      .to("http://service-b?bridgeEndpoint=true");

service-b: Spring Boot application with a REST controller. Zipkin support provided by the spring-cloud-starter-kubernetes-zipkin module from Spring Cloud.


When I make a request to service-a, I see part of the trace in Zipkin: I see the client request from service-a, and I see the server request in service-b, as well as the spans I've added there to instrument various parts of the request-path. However, I don't see the server request from the Camel portion, including the additional two seconds caused by the delay I've put in the route.

Tracing the camel-zipkin code, I've realized that the server request will only be traced if there is already a trace ID header, due to this line: https://github.com/apache/camel/blob/c6c02ff92a536e78f7ed1b9dd550d6531e852cee/components/camel-zipkin/src/main/java/org/apache/camel/zipkin/ZipkinTracer.java#L753

With this knowledge, I am able to get the entire trace as expected if I manually provide my own tracing headers (X-B3-TraceId, X-B3-Sampled, and X-B3-SpanId). However, I would like to be able to start a trace even if the client doesn't specify one.

Based on my reading of the camel-zipkin code, I think I can create a PR that will induce my desired behavior. Before I do that, though, I want to verify a couple of things:

  1. Is it valid to expect tracing to begin automatically when tracing headers are not supplied by the client?
  2. Am I missing something with my camel-zipkin configuration?

Thanks!

Chris Snyder
  • 437
  • 3
  • 14
  • 1
    Have you seen the zipkin example for how to setup it, so a new span is created (2.20.release): https://github.com/apache/camel/blob/camel-2.20.1/examples/camel-example-zipkin - the master branch has been updated to latest Zipkin and is a bit different – Claus Ibsen Dec 28 '17 at 16:37
  • I have tried that example. It seems to confirm my findings, since the client has Zipkin instrumentation (despite no client spans being reported in Zipkin). When i remove the instrumentation from the client module, the service1 module no longer reports spans. It appears that tracing can only be initiated in camel-zipkin during a client request. – Chris Snyder Dec 28 '17 at 18:32
  • I've filed a JIRA ticket for this, since I think (based on my reading of the Zipkin documentation) these IDs should be generated when they are not present. https://issues.apache.org/jira/browse/CAMEL-12109 – Chris Snyder Jan 02 '18 at 15:11

0 Answers0