Search code examples
opentracingjaeger

What is the difference between span type client and span type server?


What is the difference between span.kind=server and span.kind=clientin terms of OpenTracing? How do I know which one to pick? What does exactly it mean?

E.g. there is my service Foo which is initially called by an external service Bar. I start tracing on my Foo side and the logic is to call another service Buzz in my system to continue the flow chain. I would rather assume that external service Bar is a client, but I can't start my trace from there. What would you suggest - start tracing as client in my service Foo and then just consider all following services as servers?

Setup: k8s microservices, jaeger metrics.


Solution

  • The span.kind=server tag denotes an entry span, e.g. a span created in the local code in response to an external request. Likewise, span.kind=client denotes an exit span, e.g. a call made from the local code to another server.

    In your example, the span generated for Foo is a span.kind=server and the span recording the call to Buzz is a span.kind=client.

    Also see https://opentracing.io/specification/ and https://github.com/opentracing/specification/blob/master/semantic_conventions.md