class AsynchronousInstruments
@internal
Hierarchy
- class \OpenTelemetry\SDK\Metrics\AsynchronousInstruments
Expanded class hierarchy of AsynchronousInstruments
File
-
vendor/
open-telemetry/ sdk/ Metrics/ AsynchronousInstruments.php, line 16
Namespace
OpenTelemetry\SDK\MetricsView source
final class AsynchronousInstruments {
/**
* @param ArrayAccess<object, ObservableCallbackDestructor> $destructors
* @param non-empty-list<Instrument> $instruments
*/
public static function observe(MetricWriterInterface $writer, ArrayAccess $destructors, callable $callback, array $instruments, ReferenceCounterInterface $referenceCounter) : ObservableCallbackInterface {
$target = null;
$callback = weaken(closure($callback), $target);
$callbackId = $writer->registerCallback($callback, ...$instruments);
$referenceCounter->acquire();
$destructor = null;
if ($target) {
$destructor = $destructors[$target] ??= new ObservableCallbackDestructor($destructors, $writer);
$destructor->callbackIds[$callbackId] = $referenceCounter;
}
return new ObservableCallback($writer, $referenceCounter, $callbackId, $destructor, $target);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
AsynchronousInstruments::observe | public static | function |