Debian Codegraph @

pdata/ptrace/span_kind.go

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