Flow PHP

ManualDetector implements ResourceDetector

Read onlyYes
FinalYes

Detector that returns manually specified resource attributes.

Use this detector when you need to specify resource attributes explicitly rather than detecting them automatically. This is useful for:

  • Setting service.name and service.version explicitly
  • Adding custom attributes not covered by other detectors
  • Overriding auto-detected values when used with ChainDetector

Example usage:

$detector = new ManualDetector([
    'service.name' => 'my-app',
    'service.version' => '1.0.0',
    'deployment.environment.name' => 'production',
]);

// Combined with auto-detection (manual takes precedence when last):
$detector = new ChainDetector(
    new OsDetector(),
    new HostDetector(),
    new ManualDetector(['service.name' => 'my-app']),
);

Interfaces

ResourceDetector
Interface for detecting resource attributes from the environment.

Methods

__construct()  : mixed
detect()  : Resource
Detect resource attributes from the environment.

Methods

__construct()

public __construct([array<string, array<string|int, bool|float|int|string>|bool|float|int|string> $attributes = [] ]) : mixed
Parameters
$attributes : array<string, array<string|int, bool|float|int|string>|bool|float|int|string> = []

        
On this page

Search results