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

Breadcrumb

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

function AsynchronousInstruments::observe

Parameters

ArrayAccess<object, ObservableCallbackDestructor> $destructors:

non-empty-list<Instrument> $instruments:

2 calls to AsynchronousInstruments::observe()
Meter::batchObserve in vendor/open-telemetry/sdk/Metrics/Meter.php
Reports measurements for multiple asynchronous instrument from a single callback.
ObservableInstrumentTrait::observe in vendor/open-telemetry/sdk/Metrics/ObservableInstrumentTrait.php

File

vendor/open-telemetry/sdk/Metrics/AsynchronousInstruments.php, line 22

Class

AsynchronousInstruments
@internal

Namespace

OpenTelemetry\SDK\Metrics

Code

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);
}
RSS feed
Powered by Drupal