Skip to content
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

[backport -> release/3.4.x] feat(request-id): introduce Request ID #11970

Merged
merged 4 commits into from
Nov 20, 2023

Conversation

samugi
Copy link
Member

@samugi samugi commented Nov 9, 2023

Summary

Backport of:

to port the request ID feature to release/3.4.x

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Full changelog

  • [Implement ...]

Issue reference

KAG-3040

@samugi samugi marked this pull request as draft November 9, 2023 10:59
@samugi samugi force-pushed the cherry-pick/request-id-11624 branch from 76ad311 to 3747231 Compare November 9, 2023 11:18
@samugi samugi force-pushed the cherry-pick/request-id-11624-2 branch from 157b695 to fa9332f Compare November 9, 2023 11:20
@samugi samugi changed the title [backprot -> release/3.4.x] feat(request-id): introduce Request ID [backport -> release/3.4.x] feat(request-id): introduce Request ID Nov 9, 2023
@samugi samugi force-pushed the cherry-pick/request-id-11624-2 branch 2 times, most recently from 176d458 to e440a3b Compare November 9, 2023 14:48
@samugi samugi requested review from chobits and chronolaw November 9, 2023 15:33
@samugi samugi force-pushed the cherry-pick/request-id-11624 branch 3 times, most recently from 50a1d75 to f3e5fb1 Compare November 14, 2023 17:36
Base automatically changed from cherry-pick/request-id-11624 to release/3.4.x November 15, 2023 08:54
@samugi samugi force-pushed the cherry-pick/request-id-11624-2 branch from e440a3b to ddc716a Compare November 15, 2023 08:57
@samugi

This comment was marked as resolved.

samugi and others added 3 commits November 15, 2023 13:38
* feat(request-id): add Request ID
* Add an immutable request ID
* Include request ID + trace and correlation IDs to the log serializer
* update Access log and Error log to append request id
* update the error templates to include the request id
* Bump lua-kong-nginx-module to version 0.7.1
  * Use the new directive `lua_kong_error_log_request_id`
    introduced in 0.7.0 which adds the request id to the error log output

Includes:

* unit tests for the new `request_id` module
* integration tests to check:
  * request id, correlation id, trace ids are added to log serializer

* feat(request-id): add request-id to error templates

* feat(request-id): request ID header + span attribute

* add the x-kong-request-id downstream header which contains the value
  of the request_id, and can be controlled via the `headers` config
  option
* add the x-kong-request-id upstream header which contains the value
  of the request_id, and can be controlled via the `headers_upstream`
  config option
* add the `kong.request.id` span attribute which contains the value of
  the request_id
* tests for all the above

* docs(conf): request ID

Co-authored-by: Enrique García Cota <[email protected]>

* feat(request-id): address PR feedback

* rephrase log messages
* remove unneeded conditional

* better changelog
* use upvalues to cache headers access
* use request id instead of kong_request_id (no longer needed as we
  don't need write access)
* cache locals in hot path
* improved performance of add_trace_id_formats function
* refactored docs in kong.conf.default

* perf: cache `request_id.get()` at the module level

KAG-2034
FTI-4837

---------

Co-authored-by: samugi <[email protected]>
Co-authored-by: Enrique García Cota <[email protected]>
Co-authored-by: Qi <[email protected]>
… performance (#11725)

This has better performance than `$request_id`.

KAG-2734
…er` (#11788)

Utilize the Nginx directive
`proxy_set_header X-Kong-Request-Id $kong_request_id` instead of Lua
call `set_header()` can enhance the RPS by ~2%
in the testing scenario where no plugins are enabled.

KAG-2814
@samugi samugi force-pushed the cherry-pick/request-id-11624-2 branch from ddc716a to 2befdb0 Compare November 15, 2023 12:38
@samugi samugi marked this pull request as ready for review November 15, 2023 13:57
@samugi samugi requested a review from nowNick November 15, 2023 13:58
@kikito
Copy link
Member

kikito commented Nov 17, 2023

@chronolaw @chobits please review this backport.

@samugi samugi merged commit e2100c9 into release/3.4.x Nov 20, 2023
23 checks passed
@samugi samugi deleted the cherry-pick/request-id-11624-2 branch November 20, 2023 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants