sfhardman / kong-plugin-zipkin

Kong plugin to simulate clients and/or servers where these cannot practically be instrumented directly
Apache License 2.0
31 stars 9 forks source link

traceId: 1 to 32 character lower-hex string #6

Closed BPing closed 6 years ago

BPing commented 6 years ago

Cannot decode spans due to IllegalArgumentException(VYc0IZ1GWo2xxJpz5ZufQK6TiNERv2pI should be a 1 to 32 character lower-hex string with no prefix reading List from json)

sfhardman commented 6 years ago

Can you provide more info for troubleshooting please? e.g. which version of Zipkin and Kong? Which scenario (Simulate server, simulate client, simulate client and server)?

BPing commented 6 years ago

I use the latest version of the Zipkin docker image, but I use the V1 version of the interface。 Only accept 1 to 32 character lower-hex string

original code

local function random_string_of_len(length)
  if length > 32 then
    ngx.log(ngx.ERROR, "maximum random_string_of_len length exceeded", length)
    -- not sure how to propagate the error....
    return nil
  end
  return string.sub(utils.random_string(), 1, length)
end

i change string.sub(utils.random_string(), 1, length) to string.sub(hexstr.to_hex(utils.random_string()), 1, length),then ,it can run normally

sfhardman commented 6 years ago

Would you like to submit a pull request with a test? If not I will have a look at it.

sfhardman commented 6 years ago

Fixed in 0.1.1, thanks for reporting the issue