java-sdk icon indicating copy to clipboard operation
java-sdk copied to clipboard

Join multiple spans (grpc)

Open lullen opened this issue 4 years ago • 2 comments

I created a small sample application to try out dapr and decided to go the grpc route, while it seems a bit more unpolished it works great, so great work and thank you!

The issue I have is that while all my spans correctly shows up in zipkin they always just show one interaction. Like from Client -> Server or Server -> Access and not the full call chain which is Client -> Server -> Access. However it shows up correctly in the dependencies tab.

So my question is, how to I join the spans together?

lullen avatar May 14 '21 16:05 lullen

Seems you can propagate the traceparent header Dapr sends in through the reactor context (kotlin snip below, should be close to Java) - you'd put this on your middle service Server making the call to Access.

However! I haven't found a way to get this value from a GRPC service endpoint, only through HTTP rest endpoint headers. 😞

This contextWrite impacts the lower level call of the SDK client regardless of HTTP or GRPC from the looks of it - I just can't find out how to get the original traceparent value from an incoming GRPC invocation...

        return cli.invokeMethod(
            "charlie",
            "api/pulse-charlie",
            "",
            HttpExtension.POST,
            null,
            Date::class.java
        ).contextWrite {
            it.put("Traceparent", hdr["Traceparent"].toString())
        }.awaitFirst()

rovangju avatar May 17 '21 19:05 rovangju

I started to look into the http implementation today and it seems like that this issue also exists for http as you cant access the headers of the response.

How can I solve this? I am trying do do 1. in this artical: https://docs.dapr.io/developing-applications/building-blocks/observability/w3c-tracing/w3c-tracing-overview/#you-need-to-propagate-or-generate-trace-context-between-services

lullen avatar Nov 10 '21 17:11 lullen