summaryrefslogtreecommitdiff
path: root/vendor/open-telemetry/gen-otlp-protobuf/Opentelemetry/Proto/Metrics/V1/AggregationTemporality.php
blob: 93fb0ea9732d41ecd9523660381d1504b8cdb723 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: opentelemetry/proto/metrics/v1/metrics.proto

namespace Opentelemetry\Proto\Metrics\V1;

use UnexpectedValueException;

/**
 * AggregationTemporality defines how a metric aggregator reports aggregated
 * values. It describes how those values relate to the time interval over
 * which they are aggregated.
 *
 * Protobuf type <code>opentelemetry.proto.metrics.v1.AggregationTemporality</code>
 */
class AggregationTemporality
{
    /**
     * UNSPECIFIED is the default AggregationTemporality, it MUST not be used.
     *
     * Generated from protobuf enum <code>AGGREGATION_TEMPORALITY_UNSPECIFIED = 0;</code>
     */
    const AGGREGATION_TEMPORALITY_UNSPECIFIED = 0;
    /**
     * DELTA is an AggregationTemporality for a metric aggregator which reports
     * changes since last report time. Successive metrics contain aggregation of
     * values from continuous and non-overlapping intervals.
     * The values for a DELTA metric are based only on the time interval
     * associated with one measurement cycle. There is no dependency on
     * previous measurements like is the case for CUMULATIVE metrics.
     * For example, consider a system measuring the number of requests that
     * it receives and reports the sum of these requests every second as a
     * DELTA metric:
     *   1. The system starts receiving at time=t_0.
     *   2. A request is received, the system measures 1 request.
     *   3. A request is received, the system measures 1 request.
     *   4. A request is received, the system measures 1 request.
     *   5. The 1 second collection cycle ends. A metric is exported for the
     *      number of requests received over the interval of time t_0 to
     *      t_0+1 with a value of 3.
     *   6. A request is received, the system measures 1 request.
     *   7. A request is received, the system measures 1 request.
     *   8. The 1 second collection cycle ends. A metric is exported for the
     *      number of requests received over the interval of time t_0+1 to
     *      t_0+2 with a value of 2.
     *
     * Generated from protobuf enum <code>AGGREGATION_TEMPORALITY_DELTA = 1;</code>
     */
    const AGGREGATION_TEMPORALITY_DELTA = 1;
    /**
     * CUMULATIVE is an AggregationTemporality for a metric aggregator which
     * reports changes since a fixed start time. This means that current values
     * of a CUMULATIVE metric depend on all previous measurements since the
     * start time. Because of this, the sender is required to retain this state
     * in some form. If this state is lost or invalidated, the CUMULATIVE metric
     * values MUST be reset and a new fixed start time following the last
     * reported measurement time sent MUST be used.
     * For example, consider a system measuring the number of requests that
     * it receives and reports the sum of these requests every second as a
     * CUMULATIVE metric:
     *   1. The system starts receiving at time=t_0.
     *   2. A request is received, the system measures 1 request.
     *   3. A request is received, the system measures 1 request.
     *   4. A request is received, the system measures 1 request.
     *   5. The 1 second collection cycle ends. A metric is exported for the
     *      number of requests received over the interval of time t_0 to
     *      t_0+1 with a value of 3.
     *   6. A request is received, the system measures 1 request.
     *   7. A request is received, the system measures 1 request.
     *   8. The 1 second collection cycle ends. A metric is exported for the
     *      number of requests received over the interval of time t_0 to
     *      t_0+2 with a value of 5.
     *   9. The system experiences a fault and loses state.
     *   10. The system recovers and resumes receiving at time=t_1.
     *   11. A request is received, the system measures 1 request.
     *   12. The 1 second collection cycle ends. A metric is exported for the
     *      number of requests received over the interval of time t_1 to
     *      t_0+1 with a value of 1.
     * Note: Even though, when reporting changes since last report time, using
     * CUMULATIVE is valid, it is not recommended. This may cause problems for
     * systems that do not use start_time to determine when the aggregation
     * value was reset (e.g. Prometheus).
     *
     * Generated from protobuf enum <code>AGGREGATION_TEMPORALITY_CUMULATIVE = 2;</code>
     */
    const AGGREGATION_TEMPORALITY_CUMULATIVE = 2;

    private static $valueToName = [
        self::AGGREGATION_TEMPORALITY_UNSPECIFIED => 'AGGREGATION_TEMPORALITY_UNSPECIFIED',
        self::AGGREGATION_TEMPORALITY_DELTA => 'AGGREGATION_TEMPORALITY_DELTA',
        self::AGGREGATION_TEMPORALITY_CUMULATIVE => 'AGGREGATION_TEMPORALITY_CUMULATIVE',
    ];

    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);
    }
}