blob: 657c3ce6262d8d09439642e3d69e819fb54446f8 (
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
|
<?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();
}
}
|