OpenTelemetry PHP

Host
in package
implements ResourceDetectorInterface

FinalYes
Tags
see
https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/resource/semantic_conventions/host.md#host
https://github.com/open-telemetry/opentelemetry-specification/blob/v1.8.0/specification/resource/semantic_conventions/os.md

Table of Contents

Interfaces

ResourceDetectorInterface

Constants

PATH_ETC_HOSTID  : mixed = 'etc/hostid'
PATH_ETC_MACHINEID  : mixed = 'etc/machine-id'
PATH_VAR_LIB_DBUS_MACHINEID  : mixed = 'var/lib/dbus/machine-id'

Properties

$dir  : string
$os  : string

Methods

__construct()  : mixed
getResource()  : ResourceInfo
getBsdId()  : string|null
getLinuxId()  : string|null
getMachineId()  : string|null
getMacOsId()  : string|null
getWindowsId()  : string|null
readFile()  : string|false
run()  : string|null
The first element must be an absolute path. An argument list avoids the shell, but proc_open() still searches PATH for a bare name, and is_executable() checks a bare name against the current directory instead, so it would not stop one.

Constants

PATH_ETC_HOSTID

private mixed PATH_ETC_HOSTID = 'etc/hostid'

PATH_ETC_MACHINEID

private mixed PATH_ETC_MACHINEID = 'etc/machine-id'

PATH_VAR_LIB_DBUS_MACHINEID

private mixed PATH_VAR_LIB_DBUS_MACHINEID = 'var/lib/dbus/machine-id'

Properties

$dir read-only

private string $dir = '/'

$os read-only

private string $os = PHP_OS_FAMILY

Methods

__construct()

public __construct([string $dir = '/' ][, string $os = PHP_OS_FAMILY ]) : mixed
Parameters
$dir : string = '/'
$os : string = PHP_OS_FAMILY

getBsdId()

private getBsdId() : string|null
Return values
string|null

getLinuxId()

private getLinuxId() : string|null
Return values
string|null

getMachineId()

private getMachineId() : string|null
Return values
string|null

getMacOsId()

private getMacOsId() : string|null
Return values
string|null

getWindowsId()

private getWindowsId() : string|null
Return values
string|null

readFile()

private readFile(string $file) : string|false
Parameters
$file : string
Tags
phan-suppress

PhanTypeMismatchArgumentInternal

Return values
string|false

run()

The first element must be an absolute path. An argument list avoids the shell, but proc_open() still searches PATH for a bare name, and is_executable() checks a bare name against the current directory instead, so it would not stop one.

private run(array<int, string> $command) : string|null
Parameters
$command : array<int, string>
Return values
string|null
On this page

Search results