Skip to content

Commit

Permalink
kong/plugins/zipkin/reporter.lua: Use current kong service name as lo…
Browse files Browse the repository at this point in the history
…calEndpoint

Fixes #12
  • Loading branch information
james-callahan committed Jul 6, 2018
1 parent 8c8e791 commit 15ad4c2
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions kong/plugins/zipkin/reporter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ function zipkin_reporter_methods:report(span)
-- and https://github.com/Kong/kong-plugin-zipkin/pull/13#issuecomment-402389342
zipkin_tags[k] = tostring(v)
end
local localEndpoint do
local service = ngx.ctx.service
if service and service.name ~= ngx.null then
localEndpoint = {
serviceName = service.name;
-- TODO: ip/port from ngx.var.server_name/ngx.var.server_port?
}
else
-- needs to be null; not the empty object
localEndpoint = cjson.null
end
end
local zipkin_span = {
traceId = to_hex(span_context.trace_id);
name = span.name;
Expand All @@ -46,8 +58,7 @@ function zipkin_reporter_methods:report(span)
duration = math.floor(span.duration * 1000000); -- zipkin wants integer
-- TODO: shared?
-- TODO: debug?
localEndpoint = cjson.null, -- needs to be null; not the empty object
-- TODO: localEndpoint from ngx.var.server_name/ngx.var.server_port?
localEndpoint = localEndpoint;
remoteEndpoint = port and {
ipv4 = span:get_tag "peer.ipv4";
ipv6 = span:get_tag "peer.ipv6";
Expand Down

0 comments on commit 15ad4c2

Please sign in to comment.