diff options
author | Andrew Dolgov <[email protected]> | 2023-10-20 17:12:29 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2023-10-20 21:13:39 +0300 |
commit | cdd7ad020e165fe680703b6d3319b908b682fb7a (patch) | |
tree | b51eb09b7b4587e8fbc5624ac8d88d28cfcd0b04 /vendor/open-telemetry/sdk/Metrics/MetricFactory/StreamMetricSourceProvider.php | |
parent | 45a9ff0c88cbd33892ff16ab837e9059937d656e (diff) |
jaeger-client -> opentelemetry
Diffstat (limited to 'vendor/open-telemetry/sdk/Metrics/MetricFactory/StreamMetricSourceProvider.php')
-rw-r--r-- | vendor/open-telemetry/sdk/Metrics/MetricFactory/StreamMetricSourceProvider.php | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/vendor/open-telemetry/sdk/Metrics/MetricFactory/StreamMetricSourceProvider.php b/vendor/open-telemetry/sdk/Metrics/MetricFactory/StreamMetricSourceProvider.php new file mode 100644 index 000000000..657c3ce62 --- /dev/null +++ b/vendor/open-telemetry/sdk/Metrics/MetricFactory/StreamMetricSourceProvider.php @@ -0,0 +1,98 @@ +<?php + +declare(strict_types=1); + +namespace OpenTelemetry\SDK\Metrics\MetricFactory; + +use OpenTelemetry\SDK\Common\Instrumentation\InstrumentationScopeInterface; +use OpenTelemetry\SDK\Metrics\Instrument; +use OpenTelemetry\SDK\Metrics\MetricMetadataInterface; +use OpenTelemetry\SDK\Metrics\MetricRegistry\MetricCollectorInterface; +use OpenTelemetry\SDK\Metrics\MetricSourceInterface; +use OpenTelemetry\SDK\Metrics\MetricSourceProviderInterface; +use OpenTelemetry\SDK\Metrics\Stream\MetricStreamInterface; +use OpenTelemetry\SDK\Metrics\ViewProjection; +use OpenTelemetry\SDK\Resource\ResourceInfo; + +/** + * @internal + */ +final class StreamMetricSourceProvider implements MetricSourceProviderInterface, MetricMetadataInterface +{ + /** + * @readonly + */ + public ViewProjection $view; + /** + * @readonly + */ + public Instrument $instrument; + /** + * @readonly + */ + public InstrumentationScopeInterface $instrumentationLibrary; + /** + * @readonly + */ + public ResourceInfo $resource; + /** + * @readonly + */ + public MetricStreamInterface $stream; + /** + * @readonly + */ + public MetricCollectorInterface $metricCollector; + /** + * @readonly + */ + public int $streamId; + + public function __construct( + ViewProjection $view, + Instrument $instrument, + InstrumentationScopeInterface $instrumentationLibrary, + ResourceInfo $resource, + MetricStreamInterface $stream, + MetricCollectorInterface $metricCollector, + int $streamId + ) { + $this->view = $view; + $this->instrument = $instrument; + $this->instrumentationLibrary = $instrumentationLibrary; + $this->resource = $resource; + $this->stream = $stream; + $this->metricCollector = $metricCollector; + $this->streamId = $streamId; + } + + public function create($temporality): MetricSourceInterface + { + return new StreamMetricSource($this, $this->stream->register($temporality)); + } + + public function instrumentType() + { + return $this->instrument->type; + } + + public function name(): string + { + return $this->view->name; + } + + public function unit(): ?string + { + return $this->view->unit; + } + + public function description(): ?string + { + return $this->view->description; + } + + public function temporality() + { + return $this->stream->temporality(); + } +} |