Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultGenerator = Generator{ Prefix: HostnamePrefix(), }
DefaultGenerator is the default ID generator, using the hostname and some random bytes as its prefix.
Functions ¶
func HostnamePrefix ¶
func HostnamePrefix() string
HostnamePrefix returns a prefix based on the system's hostname, of the format:
<hostname>/<10 random bytes>
func RandomPrefix ¶
RandomPrefix returns a random prefix, a hexadecimal string of length len.
Types ¶
type Generator ¶
type Generator struct { Prefix string // contains filtered or unexported fields }
Generator generates request IDs with the set prefix.
func (*Generator) Get ¶
Get attempts to get the current request ID from the provided context.Context. It'll return an empty string if the context doesn't contain a request ID.
Click to show internal directories.
Click to hide internal directories.