Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

feat(span-name): add http.path to span name #124

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions kong/plugins/zipkin/handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,16 @@ if subsystem == "http" then
if trace_id == nil then
trace_id = rand_bytes(conf.traceid_byte_count)
end

local span_format = method
local path = req.get_path()
if conf.span_display_path == true then
span_format = method .. ' ' .. path
end

local request_span = new_span(
"SERVER",
method,
span_format,
ngx_req_start_time_mu(),
should_sample,
trace_id,
Expand All @@ -140,7 +146,7 @@ if subsystem == "http" then

request_span:set_tag("lc", "kong")
request_span:set_tag("http.method", method)
request_span:set_tag("http.path", req.get_path())
request_span:set_tag("http.path", path)

local static_tags = conf.static_tags
if type(static_tags) == "table" then
Expand Down
1 change: 1 addition & 0 deletions kong/plugins/zipkin/schema.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ return {
{ tags_header = { type = "string", required = true, default = "Zipkin-Tags" } },
{ static_tags = { type = "array", elements = static_tag,
custom_validator = validate_static_tags } },
{ span_display_path = { type = "boolean", default = false } },
},
}, },
},
Expand Down