1.3.2 trace id conflict problem
most of the times,the id is ok,but sometimes we can find conflict ids.
@Bean
@ConditionalOnMissingBean
public Random randomForSpanIds() {
return new Random();
}
i doubt that Random can be unique in distributed areas.
Can you describe what "most of the times really means?". Other people are not complaining so maybe you have introduced some wrong setup or there's a bug in sleuth. Since you haven't provided any details e.g. When the id gets duplicated, then i don't really know how i can help you
it is random,i do not know the details.but i am sure the random can not guarantee unique id in distributed areas.Maybe our apps' tps is so large.maybe i shoud use zipkin v2 span,which traceId is string ,and i can use UUID to guarantee unique id
You can consider using the spring.sleuth.traceId128=true property
FYI Twitter still uses 64-bit trace ID by default, but likely they will move to 128-bit trace IDs. I don't think you will have a problem in practice and if you do why would be an interesting question.
I'll close this issue until you get a sample that can reproduce an issue. Until then i don't see an issue here
can Random really guarantee unique id in distributed envs? @adriancole traceId128 can not be spanid accoring the DefaultTracer
a trace ID is unique per operation.
So if your concern is about span ID, you believe there's a reasonable chance of collision within the same operation. If your random generator is working, I don't think most use cases this will be a problem. This approach is used at large scale sites including google.
Issues lists aren't for hypothetical problems, rather for changes need to the code. I hope some of the context helps, but this isn't a good place to explore nuance of random generators.
maybe because of our methods tracing,the span counts are too large,so i think i have to use other techs like UUID to guarantee distributed unique ID
Sometimes when there is conflict it isnt because of random, rather a propagation bug somewhere. For example a span id reused by accident due to thread local problem. Could this be possible?
If you have custom code please ensure that you're not leaving any spans unclosed. If you can't provide an example we can replicate the problem with then i don't think we'll be able to help you
No, above you have some snippet. I have no idea what it really does. AOP - AOP around what? What does tracer() do? What is CommonUtil? This snippet doesn't help solve the problem at all. Please upload a sample of the whole project.
I have no idea what you're doing. Also when you paste the code, please format it cause it's difficult to read.
our code is ok,we have found some span ids are same,so we will use es id(we use es to store spans) instead of the random span id.the parent id problem is because our validating function had a bug and it droped some spans