-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(src): add new var $kong_request_id #70
Conversation
Given that the request ID is created for every request, it may make sense to replace the use of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide some documentation - Either in the pull request description or the README. The code looks good to me.
Have we seeded the If it has been seeded, the code looks good to me. |
Here it is:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think almost all changes are good except the length of $kong_request_id
.
Currently, we use 8 bytes as $kong_request_id
, the collision chance is sqrt(pow(256, 8)) = 4,294,967,296 (uint32_t)
.
My concern is about the cloud scenario, if there is a large volunm of traffic, the $kong_request_id
might replicate many times in a short of period.
Yes, it needs more discussion, Perhaps 12 bytes is a choice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just do what the Nginx built-in $request_id
did, using 16 bytes random data as $kong_request_id
.
Of course, but if 8 or 12 bytes random data is enough we could get a little speed up. |
86cf6a7
to
242059d
Compare
Similar to `$request_id`, but from pseudo-random number source instead of OpenSSL's `RAND_bytes` for better performance. KAG-2734 --------- Co-authored-by: Datong Sun <datong.sun@konghq.com>
* feat(error_log): custom error handler (#65) * Defines a new error log handler and a directive lua_kong_error_log_request_id that enable configuring a Request ID from the value of an nginx variable, to append to the error log. * includes tests for the new directive * tests(*): fix github workflow Co-authored-by: Chrono <chrono_cpp@me.com> Co-authored-by: Datong Sun <datong.sun@konghq.com> * tests(stream): fix mockbin failing tests * feat(variables): add new variable `$kong_request_id` (#70) Similar to `$request_id`, but from pseudo-random number source instead of OpenSSL's `RAND_bytes` for better performance. KAG-2734 --------- Co-authored-by: Chrono <chrono_cpp@me.com> Co-authored-by: Datong Sun <datong.sun@konghq.com>
See: https://konghq.atlassian.net/browse/KAG-2734
After this PR is merged, please bump the module's version.
Related PR: Kong/kong#11725