0

I am using spring-cloud-sleuth I can see the traceId and spanId in the logs, but parentTraceId is always null, not seeing it in the MDC. What can be the reason?

emanuel07
  • 738
  • 12
  • 27

1 Answers1

0

Are you sure the span has a parent? If you are looking at the first span in the tree, that one should not have a parent.

Jonatan Ivanov
  • 4,895
  • 2
  • 15
  • 30
  • I use @NewSpan annotation so I assume that the previous one should be the parent for the new one. But when I check the MDC I see only 2 keys traceId and spanId. – emanuel07 Sep 19 '22 at 23:29
  • Even if I am manually adding parentid header in the first request it is not being added to MDC. It works once I add the header as a whitelisted-mdc-keys. Shouldn’t it work by default? – emanuel07 Sep 23 '22 at 00:27