I am adding correlationIDs to our public and private APIs. This is to be able to trace a request progress through logs. UUIDs being long strings, take up much space. I need a compact alternative to UUID as a correlation ID.
It will be ok, if a correlationId repeats after a fix period (say 2 months) since the API requests older than that won't be required to be traced.
I have considered using java.util.Random nextLong()
. But it does not guarantee that it won't repeat.
Also, SecureRandom
can pose some performance issues is what I understand.
It would be good to have other options considered.
Aucun commentaire:
Enregistrer un commentaire