ensure the span and trace IDs are generated appropriately:
Span ID
16 character hex string
Randomly generated to avoid likelihood of collision, particularly in first 8 characters which will be visible on the dashboard
Trace ID:
32 character hex string
Guaranteed unique - insofar as is reasonably possible
Design
Made use of the RNGCryptoServiceProvider class to generate a cryptographically secure random byte array of the appropriate size. Then convert each byte of the array to its hexadecimal representation and concatenate these values into a string. The Trace ID version returns the full 32 character string, whereas the Span ID version returns the first 16 characters of the generated string.
Changeset
Changed id generation methods in the Span Factory class
Goal
ensure the span and trace IDs are generated appropriately:
Span ID
16 character hex string
Randomly generated to avoid likelihood of collision, particularly in first 8 characters which will be visible on the dashboard
Trace ID:
32 character hex string
Guaranteed unique - insofar as is reasonably possible
Design
Made use of the RNGCryptoServiceProvider class to generate a cryptographically secure random byte array of the appropriate size. Then convert each byte of the array to its hexadecimal representation and concatenate these values into a string. The Trace ID version returns the full 32 character string, whereas the Span ID version returns the first 16 characters of the generated string.
Changeset
Testing
Covered by existing tests