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

Commit

Permalink
fix(opentracing) name spans using just the method
Browse files Browse the repository at this point in the history
We name spans for http traffic `GET` instead of `GET http://foo.bar/baz` in order to avoid high cardinality.

See #52 (review)
  • Loading branch information
kikito committed Nov 7, 2019
1 parent 93e518a commit e8b8644
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion kong/plugins/zipkin/opentracing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ if subsystem == "http" then
local method = req.get_method()
local forwarded_ip = kong.client.get_forwarded_ip()

local request_span = tracer:start_span(method .. " " .. path, {
local request_span = tracer:start_span(method, {
child_of = wire_context,
start_timestamp = ngx.req.start_time(),
tags = {
Expand Down
6 changes: 2 additions & 4 deletions spec/zipkin_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,8 @@ describe("integration tests with mock zipkin server [#" .. strategy .. "]", func
local spans = cjson.decode((assert(stream:get_body_as_string())))
assert.equals(3, #spans)
local balancer_span, proxy_span, request_span = spans[1], spans[2], spans[3]
local url = string.format("http://mock-zipkin-route:%d/", proxy_port)
-- common assertions for request_span and proxy_span
assert_span_invariants(request_span, proxy_span, "GET " .. url)
assert_span_invariants(request_span, proxy_span, "GET")

-- specific assertions for request_span
local request_tags = request_span.tags
Expand Down Expand Up @@ -229,9 +228,8 @@ describe("integration tests with mock zipkin server [#" .. strategy .. "]", func
local spans = cjson.decode((assert(stream:get_body_as_string())))
assert.equals(2, #spans)
local proxy_span, request_span = spans[1], spans[2]
local url = string.format("http://0.0.0.0:%d/", proxy_port)
-- common assertions for request_span and proxy_span
assert_span_invariants(request_span, proxy_span, "GET " .. url)
assert_span_invariants(request_span, proxy_span, "GET")

-- specific assertions for request_span
local request_tags = request_span.tags
Expand Down

0 comments on commit e8b8644

Please sign in to comment.