Skip to content

Commit

Permalink
feat(instrumentation): remove .internal prefix
Browse files Browse the repository at this point in the history
remove .internal from the span names prefixes where not needed
  • Loading branch information
samugi committed Apr 4, 2023
1 parent 1606f4a commit 93c4f27
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions kong/tracing/instrumentation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function _M.db_query(connector)
local f = connector.query

local function wrap(self, sql, ...)
local span = tracer.start_span("kong.internal.database.query")
local span = tracer.start_span("kong.database.query")
span:set_attribute("db.system", kong.db and kong.db.strategy)
span:set_attribute("db.statement", sql) -- resource
-- raw query
Expand All @@ -58,7 +58,7 @@ end

-- Record Router span
function _M.router()
return tracer.start_span("kong.internal.router")
return tracer.start_span("kong.router")
end


Expand All @@ -77,7 +77,7 @@ function _M.balancer(ctx)
local upstream_connect_time = split(var.upstream_connect_time, ", ", "jo")
for i = 1, try_count do
local try = balancer_tries[i]
span = tracer.start_span("kong.internal.balancer", {
span = tracer.start_span("kong.balancer", {
span_kind = 3, -- client
start_time_ns = try.balancer_start * 1e6,
attributes = {
Expand Down Expand Up @@ -117,7 +117,7 @@ local function plugin_callback(phase)
local plugin_name = plugin.name
local name = name_memo[plugin_name]
if not name then
name = "kong.internal." .. phase .. ".plugin." .. plugin_name
name = "kong." .. phase .. ".plugin." .. plugin_name
name_memo[plugin_name] = name
end

Expand Down Expand Up @@ -152,7 +152,7 @@ function _M.http_client()
attributes["http.proxy"] = http_proxy
end

local span = tracer.start_span("kong.internal.http_request", {
local span = tracer.start_span("kong.internal.request", {
span_kind = 3, -- client
attributes = attributes,
})
Expand Down Expand Up @@ -222,7 +222,7 @@ do
local patch_callback

local function wrap(host, port)
local span = tracer.start_span("kong.internal.dns", {
local span = tracer.start_span("kong.dns", {
span_kind = 3, -- client
})
local ip_addr, res_port, try_list = raw_func(host, port)
Expand Down
12 changes: 6 additions & 6 deletions spec/02-integration/14-tracing/01-instrumentations_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ for _, strategy in helpers.each_strategy() do
expected_span_num = 4
end
assert.is_same(expected_span_num, #spans, res)
assert.is_same("kong.internal.database.query", spans[2].name)
assert.is_same("kong.database.query", spans[2].name)
end)
end)

Expand Down Expand Up @@ -131,7 +131,7 @@ for _, strategy in helpers.each_strategy() do
-- Making sure it's alright
local spans = cjson.decode(res)
assert.is_same(2, #spans, res)
assert.is_same("kong.internal.router", spans[2].name)
assert.is_same("kong.router", spans[2].name)
end)
end)

Expand Down Expand Up @@ -189,7 +189,7 @@ for _, strategy in helpers.each_strategy() do
-- Making sure it's alright
local spans = cjson.decode(res)
assert.is_same(2, #spans, res)
assert.is_same("kong.internal.balancer", spans[2].name)
assert.is_same("kong.balancer", spans[2].name)
end)
end)

Expand Down Expand Up @@ -218,7 +218,7 @@ for _, strategy in helpers.each_strategy() do
-- Making sure it's alright
local spans = cjson.decode(res)
assert.is_same(2, #spans, res)
assert.is_same("kong.internal.rewrite.plugin." .. tcp_trace_plugin_name, spans[2].name)
assert.is_same("kong.rewrite.plugin." .. tcp_trace_plugin_name, spans[2].name)
end)
end)

Expand Down Expand Up @@ -247,7 +247,7 @@ for _, strategy in helpers.each_strategy() do
-- Making sure it's alright
local spans = cjson.decode(res)
assert.is_same(2, #spans, res)
assert.is_same("kong.internal.header_filter.plugin." .. tcp_trace_plugin_name, spans[2].name)
assert.is_same("kong.header_filter.plugin." .. tcp_trace_plugin_name, spans[2].name)
end)
end)

Expand Down Expand Up @@ -281,7 +281,7 @@ for _, strategy in helpers.each_strategy() do

local found
for _, span in ipairs(spans) do
if span.name == "kong.internal.dns" then
if span.name == "kong.dns" then
found = true
end
end
Expand Down

0 comments on commit 93c4f27

Please sign in to comment.