Why should a Trace-ID be 128 bits? (A Surprisingly Long Answer)

(newsletter.signoz.io)

12 points | by elza_1111 a day ago ago

5 comments

  • ralferoo 32 minutes ago

    Surprised the author didn't even think about the logical conclusion of his closing paragraph: "128 bits is the ideal sweet spot, collision safety effectively forever, and it happens to match the size of a UUID, which means every database, every language, and every protocol already knows how to handle it."

    UUIDs are already generated randomly for exactly the same reason. Rather than inventing something new, they should have just used a UUID.

  • devin an hour ago

    From a practical standpoint, isn't it usually the case that there are retention periods for traces given how numerous they can be?

    I bring this up because this article starts with "I asked Claude", but it doesn't explore the the length of time you're generating IDs over at all, which is an important aspect to consider when selecting size.

    • singron 18 minutes ago

      Yes. The original Dapper used 64 bit trace ids and collisions were rarely a problem.

      If you don't drop any spans from a trace, you can completely disambiguate a collision since the trace will have two distinct root spans. If you are missing spans, you might have a break in the parent-child links.

      Even with infinite retention, your analysis will bucket by time somehow, so a collision might have no effect if the collision doesn't happen at a proximate time. If you are manually looking at traces, it will be very obvious there is a collision unless they happen at the same time.

      Also, birthday paradox only expresses probability that there is a collision somewhere, but if you are filtering or looking at single spans, then the probabiliy that you actually see a collision is greatly reduced.

      I think for basically all systems, an additional 64-bits has insignificant additional cost, so you may as well prevent collisions, but I think it could be a reasonable tradeoff if it mattered.

  • gpderetta an hour ago

    TL;DR Birthday Paradox.

    • qbane 29 minutes ago

      tl;dr we reinvented UUID and it works well