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/2.8.x] feat(request-id): introduce Request ID (#11663) #12007

Merged
merged 3 commits into from
Nov 15, 2023

Conversation

samugi
Copy link
Member

@samugi samugi commented Nov 13, 2023

Summary

Backport of:

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

Includes a bump of lua-kong-nginx-module to 0.2.2.

Checklist

Full changelog

  • [Implement ...]

Issue reference

KAG-3040

@samugi samugi marked this pull request as draft November 13, 2023 12:33
@samugi samugi force-pushed the cherry-pick/request-id-11624-28x branch 6 times, most recently from 96719da to 54fd835 Compare November 13, 2023 17:29
@samugi samugi marked this pull request as ready for review November 13, 2023 21:44
@samugi samugi marked this pull request as draft November 13, 2023 21:44
@samugi samugi force-pushed the cherry-pick/request-id-11624-28x branch from 54fd835 to 828ff9a Compare November 14, 2023 16:09
@samugi samugi marked this pull request as ready for review November 14, 2023 16:23
kong/pdk/log.lua Outdated Show resolved Hide resolved
@samugi samugi force-pushed the cherry-pick/request-id-11624-28x branch from 828ff9a to b6bf07e Compare November 15, 2023 11:25
@samugi

This comment was marked as resolved.

samugi and others added 3 commits November 15, 2023 13:37
* 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 <kikito@gmail.com>

* 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: Enrique García Cota <kikito@gmail.com>
Co-authored-by: Qi <qiqi.zhang@konghq.com>
… performance (#11725)

Bumped lua-kong-nginx-module to `0.8.0`.

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-28x branch from b6bf07e to efd533e Compare November 15, 2023 12:37
@samugi samugi merged commit 1a97e63 into release/2.8.x Nov 15, 2023
27 checks passed
@samugi samugi deleted the cherry-pick/request-id-11624-28x branch November 15, 2023 14:09
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.

5 participants