I am currently implementing Spring Cloud Sleuth in our project. I have a requirement to add the traceId to the response headers. Is there a way that this can be achieved?
Thanks,
Anoop
Using raj-kumar-bhakthavachalam example but using springframework.cloud.sleuth version 2.1.1 you may use as the following steps:
1. Autowired brave.Tracer
@Autowired
Tracer tracer
2. CurrentSpan returns TraceContext, get traceIdString
tracer.currentSpan().context().traceIdString()