Skip to content

Instantly share code, notes, and snippets.

@hackerzhut
Created May 14, 2020 00:56
Show Gist options
  • Save hackerzhut/f9b58d5bc23d25458f4fad628eef7183 to your computer and use it in GitHub Desktop.
Save hackerzhut/f9b58d5bc23d25458f4fad628eef7183 to your computer and use it in GitHub Desktop.
Sample Trace Id function
// traceID returns random traceID in uuid format.
func traceID() string {
traceID := uuid.NewV4()
hi, low := binary.LittleEndian.Uint64(traceID[:8]), binary.LittleEndian.Uint64(traceID[8:])
return fmt.Sprintf("%016x%016x", hi, low)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment