blob: f29ddfc8f7a3f2bef5c32620310b1f41b07db306 (
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
|
<?php
declare(strict_types=1);
namespace OpenTelemetry\SDK\Resource\Detectors;
use OpenTelemetry\SDK\Common\Attribute\Attributes;
use OpenTelemetry\SDK\Resource\ResourceDetectorInterface;
use OpenTelemetry\SDK\Resource\ResourceInfo;
use OpenTelemetry\SemConv\ResourceAttributes;
use function php_sapi_name;
use const PHP_VERSION;
/**
* @see https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/resource/semantic_conventions/process.md#process-runtimes
*/
final class ProcessRuntime implements ResourceDetectorInterface
{
public function getResource(): ResourceInfo
{
$attributes = [
ResourceAttributes::PROCESS_RUNTIME_NAME => php_sapi_name(),
ResourceAttributes::PROCESS_RUNTIME_VERSION => PHP_VERSION,
];
return ResourceInfo::create(Attributes::create($attributes), ResourceAttributes::SCHEMA_URL);
}
}
|