I understand that sleuth framework generated unique TraceID for every new request.
https://cloud.spring.io/spring-cloud-sleuth/
However, wanted to know how it generates the ID. is it ever possible that the unique TraceID generated today may get generated again after few months or years? is it random number generator algorithm? do I need to handle such scenarios in my application?
We use a Random
to generate a long from which we set trace / span id. https://github.com/spring-cloud/spring-cloud-sleuth/blob/master/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/autoconfig/TraceAutoConfiguration.java#L55-L59 . Here is how we use it - https://github.com/spring-cloud/spring-cloud-sleuth/blob/master/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/trace/DefaultTracer.java#L225-L228