Skip to content

Commit

Permalink
add attribute to kong span
Browse files Browse the repository at this point in the history
  • Loading branch information
liverpool8056 committed Oct 10, 2023
1 parent 771087c commit c1d6ca9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion kong/runloop/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,8 @@ return {
if not match_t then
-- tracing
if span then
span:set_attribute("http.status_code", 404)
local root_span = ctx.KONG_SPANS and ctx.KONG_SPANS[1]
root_span:set_attribute("http.status_code", 404)
span:set_status(2)
span:finish()
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ for _, strategy in helpers.each_strategy() do
assert.is_string(res)

local spans = cjson.decode(res)
local span = assert_has_span("kong.router", spans)
local span = assert_has_span("kong", spans)
assert_has_attributes(span, {
["http.status_code"] = "404",}
)
Expand Down

0 comments on commit c1d6ca9

Please sign in to comment.