DeferredMeter
class DeferredMeter implements MeterInterface
| internal |
Keep pre-fork metric instruments and callbacks usable after worker binding.
Properties
| protected MeterInterface|null | $delegate | ||
| protected DeferredCounter|DeferredGauge|DeferredHistogram|DeferredUpDownCounter> | $synchronousInstruments | ||
| protected DeferredObservableCounter|DeferredObservableGauge|DeferredObservableUpDownCounter> | $observableInstruments | ||
| protected DeferredObservableCallback> | $observableCallbacks | ||
| protected DeferredCallbackDestructor> | $callbackDestructors |
Methods
Bind this handle and every pre-fork instrument to the given provider.
Unbind this handle, its instruments, and its callback registrations.
Register one callback for multiple asynchronous instruments.
Create a counter.
Create an observable counter.
Create a histogram.
Create a gauge.
Create an observable gauge.
Create an up-down counter.
Create an observable up-down counter.
Register an observable callback that follows worker rebinding.
Forget a detached observable callback.
Map this meter's deferred instruments to their current delegates.
Determine whether the list contains an instrument owned by this meter.
Normalize the observable advisory and creation callbacks.
Convert a callback to weak target ownership when it is object-bound.
Details
at line 52
__construct(InstrumentationScope $instrumentationScope)
Create a deferred meter.
at line 60
void
bind(MeterProviderInterface $provider)
Bind this handle and every pre-fork instrument to the given provider.
at line 86
void
unbind()
Unbind this handle, its instruments, and its callback registrations.
at line 106
ObservableCallbackInterface
batchObserve(callable $callback, AsynchronousInstrument $instrument, AsynchronousInstrument ...$instruments)
Register one callback for multiple asynchronous instruments.
at line 126
CounterInterface
createCounter(string $name, string|null $unit = null, string|null $description = null, array $advisory = [])
Create a counter.
at line 143
ObservableCounterInterface
createObservableCounter(string $name, string|null $unit = null, string|null $description = null, array|callable $advisory = [], callable ...$callbacks)
Create an observable counter.
at line 170
HistogramInterface
createHistogram(string $name, string|null $unit = null, string|null $description = null, array $advisory = [])
Create a histogram.
at line 187
GaugeInterface
createGauge(string $name, string|null $unit = null, string|null $description = null, array $advisory = [])
Create a gauge.
at line 204
ObservableGaugeInterface
createObservableGauge(string $name, string|null $unit = null, string|null $description = null, array|callable $advisory = [], callable ...$callbacks)
Create an observable gauge.
at line 231
UpDownCounterInterface
createUpDownCounter(string $name, string|null $unit = null, string|null $description = null, array $advisory = [])
Create an up-down counter.
at line 248
ObservableUpDownCounterInterface
createObservableUpDownCounter(string $name, string|null $unit = null, string|null $description = null, array|callable $advisory = [], callable ...$callbacks)
Create an observable up-down counter.
at line 278
ObservableCallbackInterface
registerObservableCallback(callable $callback, array $instruments, bool $batch = false)
| internal |
Register an observable callback that follows worker rebinding.
at line 311
void
forgetObservableCallback(DeferredObservableCallback $callback, WeakReference|null $target)
| internal |
Forget a detached observable callback.
at line 338
array
mapObservableInstruments(array $instruments)
| internal |
Map this meter's deferred instruments to their current delegates.
at line 358
protected bool
containsOwnedDeferredInstrument(array $instruments)
Determine whether the list contains an instrument owned by this meter.
at line 378
protected array
normalizeObservableArguments(array|callable $advisory, array $callbacks)
Normalize the observable advisory and creation callbacks.
at line 394
static protected Closure
weakenCallback(callable $callback, object|null $target)
Convert a callback to weak target ownership when it is object-bound.
This reproduces the SDK's weak-target lifetime with public PHP APIs, so discarding the registration token cannot retain the callback's object.