propagation-keys when header is empty
StevenWillyS opened this issue · 1 comments
Hi Team,
I am using pretty old version of spring sleuth 2.1.0
for correlation id propagation on spring boot reactor
Currently using this following properties to propagate to MDC from the value that provided by myCorrelationId
header
spring.sleuth.propagation-keys=myCorrelationId
spring.sleuth.log.slf4j.whitelisted-mdc-keys=myCorrelationId
The problem come when the incoming request not providing header with myCorrelationId
key.
Is there a way to manually set the value so it can be propagated by sleuth?
I have been trying to using filter and interceptor to manually replace the http header but the value is not propagated by sleuth.
Looking for a way to add simple logic like this
if myCorrelationId == "" {
myCorrelationId = new UUID()
}
Appreciating any help and sorry for asking a kinda old version for sleuth, not sure where to search or ask anymore about this one.
Thank you.
Update:
Found a way to some sort of adding the above logic inside the app, can be placed inside the interceptor or filter.
@Autowired
private Tracer tracer;
private void fillTracer(String requestId) {
if (null != tracer) {
ExtraFieldPropagation.set(tracer.currentSpan().context(), "requestId", requestId);
}
}
Found a way to add the above logic on updated comment