git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Propagating tracing headers


Hey all,

I've been doing some experimenting with tracing Camel apps (that happen to be running in an Istio-ified OpenShift but that's not important).

My app consists of some camel routes exposed with REST that call out to other RESTful services to form an aggregate response to send back to the caller, using the splitter and enricher patterns (and AggregationStrategy POJOs) to do so.

What I found was that the OpenTracing X-b3-* HTTP headers[1] aren't preserved across these calls, so the tracing gets screwed up and spans aren't associated with the proper traces. They are somehow being stripped, somewhere.

For example, here[2] are the two uses of split/enrich from my app. Using the logger I determined that headers weren't being preserved. The workaround I found was that,
in the AggregationStrategy POJOs[3] if I do this:

original.getOut().setHeaders(original.getIn().getHeaders());

Before returning the original exchange, then things work. Basically I am manually ensuring that the headers, if stripped, are added back. Is this a bug in camel? Is this workaround good?

-James

[1] https://github.com/openzipkin/b3-propagation
[2] https://github.com/jbossdemocentral/coolstore-microservice/blob/1.2.x/coolstore-gw/src/main/java/com/redhat/coolstore/api_gateway/ProductGateway.java#L100-L101 [3] https://github.com/jbossdemocentral/coolstore-microservice/blob/1.2.x/coolstore-gw/src/main/java/com/redhat/coolstore/api_gateway/ProductGateway.java#L169-L196