1

I have two services A and B

A : it is written in spring boot

B: it is web app written in java with custom framework

I want to pass trace id generated by Spring cloud Sleuth when calling api from A to B and then want to use it in logging in B .

IF B is also written in Spring Boot then Spring cloud Sleuth given this out of box

What is best way to achieve this ?

Sahil Aggarwal
  • 1,311
  • 1
  • 12
  • 29

1 Answers1

1

If you use RestTemplate or WebClient the trace information will be sent to B.

The headers are:

  • x-b3-traceid
  • x-b3-spanid
  • x-b3-parentspanid

So you'll have to get these headers with a Filter in B and then you can for example write them to the Loggers MDC.

Simon Martinelli
  • 34,053
  • 5
  • 48
  • 82