Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Process.php

function Process::getResource

@psalm-suppress PossiblyUndefinedArrayOffset

Overrides ResourceDetectorInterface::getResource

File

vendor/open-telemetry/sdk/Resource/Detectors/Process.php, line 23

Class

Process

Namespace

OpenTelemetry\SDK\Resource\Detectors

Code

public function getResource() : ResourceInfo {
    $attributes = [];
    $attributes[ResourceAttributes::PROCESS_PID] = getmypid();
    $attributes[ResourceAttributes::PROCESS_EXECUTABLE_PATH] = PHP_BINARY;
    
    /**
     * @psalm-suppress PossiblyUndefinedArrayOffset
     */
    if ($_SERVER['argv'] ?? null) {
        $attributes[ResourceAttributes::PROCESS_COMMAND] = $_SERVER['argv'][0];
        $attributes[ResourceAttributes::PROCESS_COMMAND_ARGS] = $_SERVER['argv'];
    }
    
    /** @phan-suppress-next-line PhanTypeComparisonFromArray */
    if (extension_loaded('posix') && ($user = \posix_getpwuid(\posix_geteuid())) !== false) {
        $attributes[ResourceAttributes::PROCESS_OWNER] = $user['name'];
    }
    return ResourceInfo::create(Attributes::create($attributes), ResourceAttributes::SCHEMA_URL);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal