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

Breadcrumb

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

function Meter::batchObserve

Overrides MeterInterface::batchObserve

File

vendor/open-telemetry/sdk/Metrics/Meter.php, line 121

Class

Meter
@internal

Namespace

OpenTelemetry\SDK\Metrics

Code

public function batchObserve(callable $callback, AsynchronousInstrument $instrument, AsynchronousInstrument ...$instruments) : ObservableCallbackInterface {
    $referenceCounters = [];
    $handles = [];
    array_unshift($instruments, $instrument);
    foreach ($instruments as $instrument) {
        if (!$instrument instanceof InstrumentHandle) {
            self::logWarning('Ignoring invalid instrument provided to batchObserve, instrument not created by this SDK', [
                'instrument' => $instrument,
            ]);
            $handles[] = self::dummyInstrument();
            continue;
        }
        $asynchronousInstrument = $this->getAsynchronousInstrument($instrument->getHandle(), $this->instrumentationScope);
        if (!$asynchronousInstrument) {
            self::logWarning('Ignoring invalid instrument provided to batchObserve, instrument not created by this meter', [
                'instrument' => $instrument,
            ]);
            $handles[] = self::dummyInstrument();
            continue;
        }
        [
            $handles[],
            $referenceCounters[],
        ] = $asynchronousInstrument;
    }
    assert($handles !== []);
    return AsynchronousInstruments::observe($this->writer, $this->destructors, $callback, $handles, new MultiReferenceCounter($referenceCounters));
}

API Navigation

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