summaryrefslogtreecommitdiff
path: root/vendor/open-telemetry/gen-otlp-protobuf/Opentelemetry/Proto/Trace/V1/Span/SpanKind.php
blob: 9ffa93719a981a05b3764c0102ad6cd21cd98043 (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: opentelemetry/proto/trace/v1/trace.proto

namespace Opentelemetry\Proto\Trace\V1\Span;

use UnexpectedValueException;

/**
 * SpanKind is the type of span. Can be used to specify additional relationships between spans
 * in addition to a parent/child relationship.
 *
 * Protobuf type <code>opentelemetry.proto.trace.v1.Span.SpanKind</code>
 */
class SpanKind
{
    /**
     * Unspecified. Do NOT use as default.
     * Implementations MAY assume SpanKind to be INTERNAL when receiving UNSPECIFIED.
     *
     * Generated from protobuf enum <code>SPAN_KIND_UNSPECIFIED = 0;</code>
     */
    const SPAN_KIND_UNSPECIFIED = 0;
    /**
     * Indicates that the span represents an internal operation within an application,
     * as opposed to an operation happening at the boundaries. Default value.
     *
     * Generated from protobuf enum <code>SPAN_KIND_INTERNAL = 1;</code>
     */
    const SPAN_KIND_INTERNAL = 1;
    /**
     * Indicates that the span covers server-side handling of an RPC or other
     * remote network request.
     *
     * Generated from protobuf enum <code>SPAN_KIND_SERVER = 2;</code>
     */
    const SPAN_KIND_SERVER = 2;
    /**
     * Indicates that the span describes a request to some remote service.
     *
     * Generated from protobuf enum <code>SPAN_KIND_CLIENT = 3;</code>
     */
    const SPAN_KIND_CLIENT = 3;
    /**
     * 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.
     *
     * Generated from protobuf enum <code>SPAN_KIND_PRODUCER = 4;</code>
     */
    const SPAN_KIND_PRODUCER = 4;
    /**
     * 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.
     *
     * Generated from protobuf enum <code>SPAN_KIND_CONSUMER = 5;</code>
     */
    const SPAN_KIND_CONSUMER = 5;

    private static $valueToName = [
        self::SPAN_KIND_UNSPECIFIED => 'SPAN_KIND_UNSPECIFIED',
        self::SPAN_KIND_INTERNAL => 'SPAN_KIND_INTERNAL',
        self::SPAN_KIND_SERVER => 'SPAN_KIND_SERVER',
        self::SPAN_KIND_CLIENT => 'SPAN_KIND_CLIENT',
        self::SPAN_KIND_PRODUCER => 'SPAN_KIND_PRODUCER',
        self::SPAN_KIND_CONSUMER => 'SPAN_KIND_CONSUMER',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }


    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(SpanKind::class, \Opentelemetry\Proto\Trace\V1\Span_SpanKind::class);