Skip to content

NoopMeterHandle

The disabled-state MeterHandle: every recording is a safe no-op.

A single shared instance is reused (NoopMeterHandle::instance()), same rationale as NoopSpanHandle.

final class NoopMeterHandle implements MeterHandle

ImplementsMeterHandle
SourceTelemetry/NoopMeterHandle.php
MethodDescription
[`addCounter(string $name, intfloat $increment = 1, array $attributes = []): void`](#addcounter)
instance(): NoopMeterHandleThe shared no-op meter handle, created on first call and reused for the rest of the process.
recordGauge(string $name, float $value, array $attributes = []): voidDiscards the gauge measurement.
recordHistogram(string $name, float $value, array $attributes = []): voidDiscards the histogram measurement.

public function addCounter(string $name, int|float $increment = 1, array $attributes = []): void

Discards the counter increment.

ParameterTypeDescription
$namestring
$increment`int““float`
$attributesarray

public static function instance(): NoopMeterHandle

The shared no-op meter handle, created on first call and reused for the rest of the process.

Safe to hand out freely: it is stateless and every recording on it is discarded.

Returns NoopMeterHandle

public function recordGauge(string $name, float $value, array $attributes = []): void

Discards the gauge measurement.

ParameterTypeDescription
$namestring
$valuefloat
$attributesarray

public function recordHistogram(string $name, float $value, array $attributes = []): void

Discards the histogram measurement.

ParameterTypeDescription
$namestring
$valuefloat
$attributesarray