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/Resource/Detectors/ProcessRuntime.php | |
parent | 45a9ff0c88cbd33892ff16ab837e9059937d656e (diff) |
jaeger-client -> opentelemetry
Diffstat (limited to 'vendor/open-telemetry/sdk/Resource/Detectors/ProcessRuntime.php')
-rw-r--r-- | vendor/open-telemetry/sdk/Resource/Detectors/ProcessRuntime.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/open-telemetry/sdk/Resource/Detectors/ProcessRuntime.php b/vendor/open-telemetry/sdk/Resource/Detectors/ProcessRuntime.php new file mode 100644 index 000000000..f29ddfc8f --- /dev/null +++ b/vendor/open-telemetry/sdk/Resource/Detectors/ProcessRuntime.php @@ -0,0 +1,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); + } +} |