0
votes

The problem occurs when Spring Integration(spring boot) Application calls Spring boot application for sleuth logging of traceID and spanID from.

URL call --> Facade(written in spring integration,spring boot and supports sleuth)--> Spring boot microservice(Sleuth supported)

Microservice 1 : spring integration Http call

Microservice 2 : spring boot Rest controller

Here is the detail of the logs of both of the microservices.

Microservice 1 calls Microservice 2

Microserice 1 log:

2017-04-18 17:42:31.887[0;39m [32m INFO [CS Facade,ff711e7b275d03a7,b3f14f1a5cf6bd1d,true][0;39m [35m6280[0;39m [2m---[0;39m [2m[

Microservice 2 log :

[2m2017-04-18 17:43:26.133[0;39m [32m INFO [-,32226de675c3a463,32226de675c3a463,false][0;39m [35m14184[0;39m [2m---[0;39m [2m[nio-8083-exec-1][0;39m [36mc.t.cloud.resource.HelloResource

Although, both have same request call , traceID is different. It works perfect when both the application are pure spring boot application and no http spring Integration used.

Microservice 1 Code

<int-http:outbound-gateway id="getAccount"
        url="http://localhost:8083/rest/hello/micro2"
        request-channel="receiveChannel" reply-channel="publishsubscribechannel"
        http-method="GET" expected-response-type="java.lang.String">

</int-http:outbound-gateway>

Microservice 2 code

@GetMapping(value = "/micro2")
public String hello() {

    LOGGER.info("Reached micro2"+accessor.getCurrentSpan());
    return "HelloWorld";
}
2
Welcome to SO. And what exactly is your question?Uwe Allner
updated the question. thxAtul

2 Answers

0
votes

I'm sorry but you formatted the code and wrote the text in such a way that I barely understand what the problem is. If both apps are Spring Boot and everything is working fine? That's not strange cause Sleuth is a Boot based library. That means that it's enough to use Boot and Sleuth registers all the necessary components. In case of a non Spring Boot app you basically have to do all the work yourself. That means pass the tracing headers either via HTTP or messaging.

0
votes

Up to Sleuth 2.1.0, spring-integration won't propagate the X-B3* headers automatically.

https://github.com/spring-cloud/spring-cloud-sleuth/issues/1333 with workaround.