Skip to content

Commit

Permalink
feat(request-id): address PR feedback
Browse files Browse the repository at this point in the history
* rephrase log message
* remove unneeded conditional
  • Loading branch information
samugi committed Sep 26, 2023
1 parent 1b932fd commit c652620
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions kong/runloop/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ return {
-- X-Kong-Request-Id upstream header
local rid, rid_get_err = request_id.get()
if not rid then
log(WARN, "failed to set X-Kong-Request-Id header: ", rid_get_err)
log(WARN, "failed to get Request ID: ", rid_get_err)
end

local request_id_header = constants.HEADERS.REQUEST_ID
Expand Down Expand Up @@ -1530,7 +1530,7 @@ return {
-- X-Kong-Request-Id downstream header
local rid, rid_get_err = request_id.get()
if not rid then
log(WARN, "failed to set X-Kong-Request-Id header: ", rid_get_err)
log(WARN, "failed to get Request ID: ", rid_get_err)
end

local request_id_header = constants.HEADERS.REQUEST_ID
Expand Down
6 changes: 2 additions & 4 deletions kong/tracing/propagation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -546,11 +546,9 @@ local function add_trace_id_formats(trace_id_new_fmt)
-- TODO: @samugi - move this in the unified tracing context
local trace_id_all_fmt = ngx.ctx.propagation_trace_id_all_fmt or {}

-- add new formats to trace ID (if not already present)
-- add new formats to trace ID
for format, value in pairs(trace_id_new_fmt) do
if not trace_id_all_fmt[format] then
trace_id_all_fmt[format] = value
end
trace_id_all_fmt[format] = value
end

ngx.ctx.propagation_trace_id_all_fmt = trace_id_all_fmt
Expand Down

0 comments on commit c652620

Please sign in to comment.