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:
- Is it valid to expect tracing to begin automatically when tracing headers are not supplied by the client?
- Am I missing something with my camel-zipkin configuration?
Thanks!