https://kotlinlang.org logo
#http4k
Title
# http4k
r

Razvan

01/15/2021, 10:01 AM
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

s4nchez

01/15/2021, 10:13 AM
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

Razvan

01/15/2021, 10:15 AM
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

s4nchez

01/15/2021, 10:23 AM
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

Razvan

01/15/2021, 10:27 AM
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

s4nchez

01/15/2021, 3:59 PM
Sorry for the delay. Gotcha. I do think you hit a bug. I'll try and write a full test for it.
r

Razvan

01/15/2021, 5:19 PM
Thanks do you want me to report it in github or you'll trace it ?
s

s4nchez

01/15/2021, 5:54 PM
Up to you, really. It's already on my radar now.
3 Views