-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
span_kind.go
54 lines (49 loc) · 2.21 KB
/
span_kind.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package ptrace // import "go.opentelemetry.io/collector/pdata/ptrace"
import (
otlptrace "go.opentelemetry.io/collector/pdata/internal/data/protogen/trace/v1"
)
// SpanKind is the type of span. Can be used to specify additional relationships between spans
// in addition to a parent/child relationship.
type SpanKind int32
const (
// SpanKindUnspecified represents that the SpanKind is unspecified, it MUST NOT be used.
SpanKindUnspecified = SpanKind(otlptrace.Span_SPAN_KIND_UNSPECIFIED)
// SpanKindInternal indicates that the span represents an internal operation within an application,
// as opposed to an operation happening at the boundaries. Default value.
SpanKindInternal = SpanKind(otlptrace.Span_SPAN_KIND_INTERNAL)
// SpanKindServer indicates that the span covers server-side handling of an RPC or other
// remote network request.
SpanKindServer = SpanKind(otlptrace.Span_SPAN_KIND_SERVER)
// SpanKindClient indicates that the span describes a request to some remote service.
SpanKindClient = SpanKind(otlptrace.Span_SPAN_KIND_CLIENT)
// SpanKindProducer indicates that the span describes a producer sending a message to a broker.
// Unlike CLIENT and SERVER, there is often no direct critical path latency relationship
// between producer and consumer spans.
// A PRODUCER span ends when the message was accepted by the broker while the logical processing of
// the message might span a much longer time.
SpanKindProducer = SpanKind(otlptrace.Span_SPAN_KIND_PRODUCER)
// SpanKindConsumer indicates that the span describes consumer receiving a message from a broker.
// Like the PRODUCER kind, there is often no direct critical path latency relationship between
// producer and consumer spans.
SpanKindConsumer = SpanKind(otlptrace.Span_SPAN_KIND_CONSUMER)
)
// String returns the string representation of the SpanKind.
func (sk SpanKind) String() string {
switch sk {
case SpanKindUnspecified:
return "Unspecified"
case SpanKindInternal:
return "Internal"
case SpanKindServer:
return "Server"
case SpanKindClient:
return "Client"
case SpanKindProducer:
return "Producer"
case SpanKindConsumer:
return "Consumer"
}
return ""
}