feat: add ksuid algorithm on request-id plugin#12573
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds the ksuid algorithm as a new option for the request-id plugin, enabling generation of 27-character sequential IDs that are lexicographically sortable by timestamp with strong collision protection.
- Introduces
ksuidas a new algorithm option alongside existinguuid,nanoid, andrange_idalgorithms - Adds comprehensive test coverage for the new ksuid functionality including validation of ID format and uniqueness
- Updates documentation in both English and Chinese to describe the new ksuid algorithm and provide usage examples
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| apisix/plugins/request-id.lua | Adds ksuid algorithm support and dependency import |
| apisix-master-0.rockspec | Adds lua-resty-ksuid dependency |
| t/plugin/request-id3.t | New test file for ksuid algorithm validation |
| docs/en/latest/plugins/request-id.md | English documentation updates for ksuid algorithm |
| docs/zh/latest/plugins/request-id.md | Chinese documentation updates for ksuid algorithm |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| ngx.say(id) | ||
| return | ||
| end | ||
|
|
There was a problem hiding this comment.
Remove trailing whitespace on this line to maintain code cleanliness.
Suggested change
Baoyuantop
reviewed
Sep 2, 2025
Contributor
Author
|
code and translation has been adjusted |
Contributor
Author
|
I correct code style issues on ci , need you review and approval again @Baoyuantop |
Baoyuantop
self-requested a review
September 3, 2025 08:50
Baoyuantop
approved these changes
Sep 4, 2025
Baoyuantop
requested review from
AlinsRan,
Revolyssup,
bzp2010,
kayx23,
membphis and
nic-6443
September 4, 2025 07:36
membphis
approved these changes
Sep 4, 2025
nic-6443
approved these changes
Sep 5, 2025
jizhuozhi
pushed a commit
to jizhuozhi/apisix
that referenced
this pull request
Oct 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue(s) this PR fixes:
Feat # #12559
This pr introduces the ksuid algorithm for request-id which generates a sequential ID always 27 characters encoded in alphanumeric base62 that will lexicographically sort by timestamp. retain their time-ordered property through a string and it enough 128-bit of randomness to provide strong protection against collisions (duplicates),more than uuid
e.g.
Checklist