SpanKind
SpanKind
SpanKind details the relationships between spans in addition to the parent/child relationship. SpanKind is enumerated by the following values:
Type | Value | Meaning |
---|---|---|
SERVER | 1 | The span covers the server-side handling of an RPC |
CLIENT | 2 | The span covers the client-side handling of an RPC |
UNSPECIFIED | 0 | Unspecified |
For example, given two spans that share the same name and traceID, if a trace starts
on the client and then progresses to the server for continuity, their Kind
can be set as CLIENT
and SERVER
respectively
Source code example
// Started on the client
ctx, cSpan := trace.StartSpan(ctx, "SpanStarted", trace.WithSpanKind(trace.SpanKindClient))
// Received from the server
ctx, sSpan := trace.StartSpan(ctx, "SpanStarted", trace.WithSpanKind(trace.SpanKindServer))
References
Resource | URL |
---|---|
SpanKind proto | proto/trace/v1.Span.SpanKind |
Go API | WithSpanKind option |
Java API | Span.Kind JavaDoc |
Python API | span.SpanKind |
Node.js API | span.SpanKind |