summaryrefslogtreecommitdiff
path: root/vendor/open-telemetry/sdk/Metrics/Data
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/open-telemetry/sdk/Metrics/Data')
-rw-r--r--vendor/open-telemetry/sdk/Metrics/Data/DataInterface.php9
-rw-r--r--vendor/open-telemetry/sdk/Metrics/Data/Exemplar.php65
-rw-r--r--vendor/open-telemetry/sdk/Metrics/Data/Gauge.php22
-rw-r--r--vendor/open-telemetry/sdk/Metrics/Data/Histogram.php29
-rw-r--r--vendor/open-telemetry/sdk/Metrics/Data/HistogramDataPoint.php76
-rw-r--r--vendor/open-telemetry/sdk/Metrics/Data/Metric.php46
-rw-r--r--vendor/open-telemetry/sdk/Metrics/Data/NumberDataPoint.php43
-rw-r--r--vendor/open-telemetry/sdk/Metrics/Data/Sum.php34
-rw-r--r--vendor/open-telemetry/sdk/Metrics/Data/Temporality.php20
9 files changed, 344 insertions, 0 deletions
diff --git a/vendor/open-telemetry/sdk/Metrics/Data/DataInterface.php b/vendor/open-telemetry/sdk/Metrics/Data/DataInterface.php
new file mode 100644
index 000000000..7aa0c0e20
--- /dev/null
+++ b/vendor/open-telemetry/sdk/Metrics/Data/DataInterface.php
@@ -0,0 +1,9 @@
+<?php
+
+declare(strict_types=1);
+
+namespace OpenTelemetry\SDK\Metrics\Data;
+
+interface DataInterface
+{
+}
diff --git a/vendor/open-telemetry/sdk/Metrics/Data/Exemplar.php b/vendor/open-telemetry/sdk/Metrics/Data/Exemplar.php
new file mode 100644
index 000000000..bd2034f75
--- /dev/null
+++ b/vendor/open-telemetry/sdk/Metrics/Data/Exemplar.php
@@ -0,0 +1,65 @@
+<?php
+
+declare(strict_types=1);
+
+namespace OpenTelemetry\SDK\Metrics\Data;
+
+use OpenTelemetry\SDK\Common\Attribute\AttributesInterface;
+
+final class Exemplar
+{
+
+ /**
+ * @var int|string
+ */
+ private $index;
+ /**
+ * @var float|int
+ * @readonly
+ */
+ public $value;
+ /**
+ * @readonly
+ */
+ public int $timestamp;
+ /**
+ * @readonly
+ */
+ public AttributesInterface $attributes;
+ /**
+ * @readonly
+ */
+ public ?string $traceId;
+ /**
+ * @readonly
+ */
+ public ?string $spanId;
+
+ /**
+ * @param int|string $index
+ * @param float|int $value
+ */
+ public function __construct($index, $value, int $timestamp, AttributesInterface $attributes, ?string $traceId, ?string $spanId)
+ {
+ $this->index = $index;
+ $this->value = $value;
+ $this->timestamp = $timestamp;
+ $this->attributes = $attributes;
+ $this->traceId = $traceId;
+ $this->spanId = $spanId;
+ }
+
+ /**
+ * @param iterable<Exemplar> $exemplars
+ * @return array<list<Exemplar>>
+ */
+ public static function groupByIndex(iterable $exemplars): array
+ {
+ $grouped = [];
+ foreach ($exemplars as $exemplar) {
+ $grouped[$exemplar->index][] = $exemplar;
+ }
+
+ return $grouped;
+ }
+}
diff --git a/vendor/open-telemetry/sdk/Metrics/Data/Gauge.php b/vendor/open-telemetry/sdk/Metrics/Data/Gauge.php
new file mode 100644
index 000000000..00eb50939
--- /dev/null
+++ b/vendor/open-telemetry/sdk/Metrics/Data/Gauge.php
@@ -0,0 +1,22 @@
+<?php
+
+declare(strict_types=1);
+
+namespace OpenTelemetry\SDK\Metrics\Data;
+
+final class Gauge implements DataInterface
+{
+
+ /**
+ * @var iterable<NumberDataPoint>
+ * @readonly
+ */
+ public iterable $dataPoints;
+ /**
+ * @param iterable<NumberDataPoint> $dataPoints
+ */
+ public function __construct(iterable $dataPoints)
+ {
+ $this->dataPoints = $dataPoints;
+ }
+}
diff --git a/vendor/open-telemetry/sdk/Metrics/Data/Histogram.php b/vendor/open-telemetry/sdk/Metrics/Data/Histogram.php
new file mode 100644
index 000000000..782698026
--- /dev/null
+++ b/vendor/open-telemetry/sdk/Metrics/Data/Histogram.php
@@ -0,0 +1,29 @@
+<?php
+
+declare(strict_types=1);
+
+namespace OpenTelemetry\SDK\Metrics\Data;
+
+final class Histogram implements DataInterface
+{
+
+ /**
+ * @var iterable<HistogramDataPoint>
+ * @readonly
+ */
+ public iterable $dataPoints;
+ /**
+ * @var string|Temporality
+ * @readonly
+ */
+ public $temporality;
+ /**
+ * @param iterable<HistogramDataPoint> $dataPoints
+ * @param string|Temporality $temporality
+ */
+ public function __construct(iterable $dataPoints, $temporality)
+ {
+ $this->dataPoints = $dataPoints;
+ $this->temporality = $temporality;
+ }
+}
diff --git a/vendor/open-telemetry/sdk/Metrics/Data/HistogramDataPoint.php b/vendor/open-telemetry/sdk/Metrics/Data/HistogramDataPoint.php
new file mode 100644
index 000000000..4c9df07b4
--- /dev/null
+++ b/vendor/open-telemetry/sdk/Metrics/Data/HistogramDataPoint.php
@@ -0,0 +1,76 @@
+<?php
+
+declare(strict_types=1);
+
+namespace OpenTelemetry\SDK\Metrics\Data;
+
+use OpenTelemetry\SDK\Common\Attribute\AttributesInterface;
+
+final class HistogramDataPoint
+{
+ /**
+ * @readonly
+ */
+ public int $count;
+ /**
+ * @var float|int
+ * @readonly
+ */
+ public $sum;
+ /**
+ * @var float|int
+ * @readonly
+ */
+ public $min;
+ /**
+ * @var float|int
+ * @readonly
+ */
+ public $max;
+ /**
+ * @var int[]
+ * @readonly
+ */
+ public array $bucketCounts;
+ /**
+ * @var list<float|int>
+ * @readonly
+ */
+ public array $explicitBounds;
+ /**
+ * @readonly
+ */
+ public AttributesInterface $attributes;
+ /**
+ * @readonly
+ */
+ public int $startTimestamp;
+ /**
+ * @readonly
+ */
+ public int $timestamp;
+ /**
+ * @readonly
+ */
+ public iterable $exemplars = [];
+ /**
+ * @param float|int $sum
+ * @param float|int $min
+ * @param float|int $max
+ * @param int[] $bucketCounts
+ * @param list<float|int> $explicitBounds
+ */
+ public function __construct(int $count, $sum, $min, $max, array $bucketCounts, array $explicitBounds, AttributesInterface $attributes, int $startTimestamp, int $timestamp, iterable $exemplars = [])
+ {
+ $this->count = $count;
+ $this->sum = $sum;
+ $this->min = $min;
+ $this->max = $max;
+ $this->bucketCounts = $bucketCounts;
+ $this->explicitBounds = $explicitBounds;
+ $this->attributes = $attributes;
+ $this->startTimestamp = $startTimestamp;
+ $this->timestamp = $timestamp;
+ $this->exemplars = $exemplars;
+ }
+}
diff --git a/vendor/open-telemetry/sdk/Metrics/Data/Metric.php b/vendor/open-telemetry/sdk/Metrics/Data/Metric.php
new file mode 100644
index 000000000..41fcb52dd
--- /dev/null
+++ b/vendor/open-telemetry/sdk/Metrics/Data/Metric.php
@@ -0,0 +1,46 @@
+<?php
+
+declare(strict_types=1);
+
+namespace OpenTelemetry\SDK\Metrics\Data;
+
+use OpenTelemetry\SDK\Common\Instrumentation\InstrumentationScopeInterface;
+use OpenTelemetry\SDK\Resource\ResourceInfo;
+
+final class Metric
+{
+ /**
+ * @readonly
+ */
+ public InstrumentationScopeInterface $instrumentationScope;
+ /**
+ * @readonly
+ */
+ public ResourceInfo $resource;
+ /**
+ * @readonly
+ */
+ public string $name;
+ /**
+ * @readonly
+ */
+ public ?string $description;
+ /**
+ * @readonly
+ */
+ public ?string $unit;
+ /**
+ * @readonly
+ */
+ public DataInterface $data;
+
+ public function __construct(InstrumentationScopeInterface $instrumentationScope, ResourceInfo $resource, string $name, ?string $unit, ?string $description, DataInterface $data)
+ {
+ $this->instrumentationScope = $instrumentationScope;
+ $this->resource = $resource;
+ $this->name = $name;
+ $this->description = $description;
+ $this->unit = $unit;
+ $this->data = $data;
+ }
+}
diff --git a/vendor/open-telemetry/sdk/Metrics/Data/NumberDataPoint.php b/vendor/open-telemetry/sdk/Metrics/Data/NumberDataPoint.php
new file mode 100644
index 000000000..1d00e783a
--- /dev/null
+++ b/vendor/open-telemetry/sdk/Metrics/Data/NumberDataPoint.php
@@ -0,0 +1,43 @@
+<?php
+
+declare(strict_types=1);
+
+namespace OpenTelemetry\SDK\Metrics\Data;
+
+use OpenTelemetry\SDK\Common\Attribute\AttributesInterface;
+
+final class NumberDataPoint
+{
+ /**
+ * @var float|int
+ * @readonly
+ */
+ public $value;
+ /**
+ * @readonly
+ */
+ public AttributesInterface $attributes;
+ /**
+ * @readonly
+ */
+ public int $startTimestamp;
+ /**
+ * @readonly
+ */
+ public int $timestamp;
+ /**
+ * @readonly
+ */
+ public iterable $exemplars = [];
+ /**
+ * @param float|int $value
+ */
+ public function __construct($value, AttributesInterface $attributes, int $startTimestamp, int $timestamp, iterable $exemplars = [])
+ {
+ $this->value = $value;
+ $this->attributes = $attributes;
+ $this->startTimestamp = $startTimestamp;
+ $this->timestamp = $timestamp;
+ $this->exemplars = $exemplars;
+ }
+}
diff --git a/vendor/open-telemetry/sdk/Metrics/Data/Sum.php b/vendor/open-telemetry/sdk/Metrics/Data/Sum.php
new file mode 100644
index 000000000..77c4c1021
--- /dev/null
+++ b/vendor/open-telemetry/sdk/Metrics/Data/Sum.php
@@ -0,0 +1,34 @@
+<?php
+
+declare(strict_types=1);
+
+namespace OpenTelemetry\SDK\Metrics\Data;
+
+final class Sum implements DataInterface
+{
+
+ /**
+ * @var iterable<NumberDataPoint>
+ * @readonly
+ */
+ public iterable $dataPoints;
+ /**
+ * @var string|Temporality
+ * @readonly
+ */
+ public $temporality;
+ /**
+ * @readonly
+ */
+ public bool $monotonic;
+ /**
+ * @param iterable<NumberDataPoint> $dataPoints
+ * @param string|Temporality $temporality
+ */
+ public function __construct(iterable $dataPoints, $temporality, bool $monotonic)
+ {
+ $this->dataPoints = $dataPoints;
+ $this->temporality = $temporality;
+ $this->monotonic = $monotonic;
+ }
+}
diff --git a/vendor/open-telemetry/sdk/Metrics/Data/Temporality.php b/vendor/open-telemetry/sdk/Metrics/Data/Temporality.php
new file mode 100644
index 000000000..b6642ebd0
--- /dev/null
+++ b/vendor/open-telemetry/sdk/Metrics/Data/Temporality.php
@@ -0,0 +1,20 @@
+<?php
+
+declare(strict_types=1);
+
+namespace OpenTelemetry\SDK\Metrics\Data;
+
+/**
+ * Metric aggregation temporality.
+ *
+ * Has to be type-hinted as `string|Temporality` to be forward compatible.
+ */
+final class Temporality
+{
+ public const DELTA = 'Delta';
+ public const CUMULATIVE = 'Cumulative';
+
+ private function __construct()
+ {
+ }
+}