Hi, I have several issues with ZipkinTraces. I'll ...
# http4k
r
Hi, I have several issues with ZipkinTraces. I'll post them in the thread.
1. ZiplinTraces for client call does not create a new span_id if current parentId is null:
Copy code
@Test
    fun `client does not create new span_id if parent null`() {
        val cliWithEvents = ClientFilters.RequestTracing()
            .then(
                ResponseFilters.ReportHttpTransaction {
                    println("REQUEST:" + it.request)
                })
            .then({ Response(OK) })

        ZipkinTraces.setForCurrentThread(ZipkinTraces(TraceId("trace_id"), TraceId("span_id"), null))
        cliWithEvents(Request(Method.GET, "/parentNull"))

        ZipkinTraces.setForCurrentThread(ZipkinTraces(TraceId("trace_id"), TraceId("span_id"), TraceId("parent_id")))
        cliWithEvents(Request(Method.GET, "/parentNotNull"))
    }
prints:
Copy code
REQUEST:GET /parentNull HTTP/1.1
x-b3-traceid: trace_id
x-b3-spanid: span_id
x-b3-sampled: 1


REQUEST:GET /parentNotNull HTTP/1.1
x-b3-traceid: trace_id
x-b3-spanid: 588dc95032d588ca
x-b3-parentspanid: span_id
x-b3-sampled: 1
I expected to be the second one for both
s
Not sure I follow. What it's printed seem correct to me: • traceId got propagated • spanId of parent becomes parentspanId of child • new spanId created in child
How did you expect it to look?
r
Both should be the same as the second one,. no reason if the parentid before the client call is null to not create a new span, and use the parent's spanid as parentId. In both cases wheather or not before the call parent is null there should be:
Copy code
x-b3-traceid: trace_id
x-b3-spanid: 588dc95032d588ca
x-b3-parentspanid: span_id
x-b3-sampled: 1
s
I'm still lost. Maybe it'd help me if you show how you expected the two requests to look like (as in the example above), as I could't understand even which request is wrong 😞
r
Should print:
Copy code
REQUEST:GET /parentNull HTTP/1.1
x-b3-traceid: trace_id
x-b3-spanid: 588dc95032d588ca
x-b3-parentspanid: span_id
x-b3-sampled: 1

REQUEST:GET /parentNotNull HTTP/1.1
x-b3-traceid: trace_id
x-b3-spanid: 588dc95032d588ca
x-b3-parentspanid: span_id
x-b3-sampled: 1
But instead, in the first case (call on
/parentNull
) there is no parentspanId and not a new spanId
In the first answer
Copy code
REQUEST:GET /parentNull HTTP/1.1
x-b3-traceid: trace_id
x-b3-spanid: span_id  ******* THIS IS WRONG SHOULD BE A NEW SPAN ID ******
**** THERE SHOULD BE x-b3-parentspanid: span_id*******
x-b3-sampled: 1
s
Sorry for the delay. Gotcha. I do think you hit a bug. I'll try and write a full test for it.
r
Thanks do you want me to report it in github or you'll trace it ?
s
Up to you, really. It's already on my radar now.