Skip to content

Concerns on XID Usage and Truncation #1349

@jentfoo

Description

@jentfoo

I wanted to ask a question around the usage of XID, and notably truncating it on the client side for clients which configure shorter correlation ID's:

correlationID = xid.New().String()
if len(correlationID) > options.CorrelationIdLength {
correlationID = correlationID[:options.CorrelationIdLength]
}

Because XID is structured ([4B timestamp][3B machine ID][2B PID][3B counter]) truncating like this changes the correlation id behavior, and changes what usages may be more likely to conflict (the second resolution timestamp prefix is the primary protection today when truncating).

I also wondered why XID was chosen generally. The sorting from timestamp has some value, but the machine correlation seems like a slight privacy concern (ability to correlate to creating system).

I suggest we transition to either only a timestamp prefixed value (followed by random), or a completely random value (both of which would be safe to truncate). But I wanted to file an issue and ask around the motivation around XID first before submitting a PR. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugInconsistencies or issues which will cause an issue or problem for users or implementors.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions