MeterInterface
in
Table of Contents
Methods
- batchObserve() : ObservableCallbackInterface
- Reports measurements for multiple asynchronous instrument from a single callback.
- createCounter() : CounterInterface
- Creates a `Counter`.
- createGauge() : GaugeInterface
- Creates a `Gauge`.
- createHistogram() : HistogramInterface
- Creates a `Histogram`.
- createObservableCounter() : ObservableCounterInterface
- Creates an `ObservableCounter`.
- createObservableGauge() : ObservableGaugeInterface
- Creates an `ObservableGauge`.
- createObservableUpDownCounter() : ObservableUpDownCounterInterface
- Creates an `ObservableUpDownCounter`.
- createUpDownCounter() : UpDownCounterInterface
- Creates an `UpDownCounter`.
Methods
batchObserve()
Reports measurements for multiple asynchronous instrument from a single callback.
public
batchObserve(callable $callback, AsynchronousInstrument $instrument, AsynchronousInstrument ...$instruments) : ObservableCallbackInterface
The callback receives an for each instrument. All provided instruments have to be created by this meter.
$callback = $meter->batchObserve(
function(
ObserverInterface $usageObserver,
ObserverInterface $pressureObserver,
): void {
[$usage, $pressure] = expensive_system_call();
$usageObserver->observe($usage);
$pressureObserver->observe($pressure);
},
$meter->createObservableCounter('usage', description: 'count of items used'),
$meter->createObservableGauge('pressure', description: 'force per unit area'),
);
Parameters
- $callback : callable
-
function responsible for reporting the measurements
- $instrument : AsynchronousInstrument
-
first instrument to report measurements for
- $instruments : AsynchronousInstrument
-
additional instruments to report measurements for
Tags
Return values
ObservableCallbackInterface —token to detach callback
createCounter()
Creates a `Counter`.
public
createCounter(string $name[, string|null $unit = null ][, string|null $description = null ][, array<string|int, mixed> $advisory = [] ]) : CounterInterface
Parameters
- $name : string
-
name of the instrument
- $unit : string|null = null
-
unit of measure
- $description : string|null = null
-
description of the instrument
- $advisory : array<string|int, mixed> = []
-
an optional set of recommendations
Tags
Return values
CounterInterface —created instrument
createGauge()
Creates a `Gauge`.
public
createGauge(string $name[, string|null $unit = null ][, string|null $description = null ][, array<string|int, mixed> $advisory = [] ]) : GaugeInterface
Parameters
- $name : string
-
name of the instrument
- $unit : string|null = null
-
unit of measure
- $description : string|null = null
-
description of the instrument
- $advisory : array<string|int, mixed> = []
-
an optional set of recommendations
Tags
Return values
GaugeInterface —created instrument
createHistogram()
Creates a `Histogram`.
public
createHistogram(string $name[, string|null $unit = null ][, string|null $description = null ][, array<string|int, mixed> $advisory = [] ]) : HistogramInterface
Parameters
- $name : string
-
name of the instrument
- $unit : string|null = null
-
unit of measure
- $description : string|null = null
-
description of the instrument
- $advisory : array<string|int, mixed> = []
-
an optional set of recommendations, e.g.
['ExplicitBucketBoundaries' => [0.25, 0.5, 1, 5]]
Tags
Return values
HistogramInterface —created instrument
createObservableCounter()
Creates an `ObservableCounter`.
public
createObservableCounter(string $name[, string|null $unit = null ][, string|null $description = null ][, array<string|int, mixed>|callable $advisory = [] ], callable ...$callbacks) : ObservableCounterInterface
Parameters
- $name : string
-
name of the instrument
- $unit : string|null = null
-
unit of measure
- $description : string|null = null
-
description of the instrument
- $advisory : array<string|int, mixed>|callable = []
-
an optional set of recommendations, or deprecated: the first callback to report measurements
- $callbacks : callable
-
responsible for reporting measurements
Tags
Return values
ObservableCounterInterface —created instrument
createObservableGauge()
Creates an `ObservableGauge`.
public
createObservableGauge(string $name[, string|null $unit = null ][, string|null $description = null ][, array<string|int, mixed>|callable $advisory = [] ], callable ...$callbacks) : ObservableGaugeInterface
Parameters
- $name : string
-
name of the instrument
- $unit : string|null = null
-
unit of measure
- $description : string|null = null
-
description of the instrument
- $advisory : array<string|int, mixed>|callable = []
-
an optional set of recommendations, or deprecated: the first callback to report measurements
- $callbacks : callable
-
responsible for reporting measurements
Tags
Return values
ObservableGaugeInterface —created instrument
createObservableUpDownCounter()
Creates an `ObservableUpDownCounter`.
public
createObservableUpDownCounter(string $name[, string|null $unit = null ][, string|null $description = null ][, array<string|int, mixed>|callable $advisory = [] ], callable ...$callbacks) : ObservableUpDownCounterInterface
Parameters
- $name : string
-
name of the instrument
- $unit : string|null = null
-
unit of measure
- $description : string|null = null
-
description of the instrument
- $advisory : array<string|int, mixed>|callable = []
-
an optional set of recommendations, or deprecated: the first callback to report measurements
- $callbacks : callable
-
responsible for reporting measurements
Tags
Return values
ObservableUpDownCounterInterface —created instrument
createUpDownCounter()
Creates an `UpDownCounter`.
public
createUpDownCounter(string $name[, string|null $unit = null ][, string|null $description = null ][, array<string|int, mixed> $advisory = [] ]) : UpDownCounterInterface
Parameters
- $name : string
-
name of the instrument
- $unit : string|null = null
-
unit of measure
- $description : string|null = null
-
description of the instrument
- $advisory : array<string|int, mixed> = []
-
an optional set of recommendations
Tags
Return values
UpDownCounterInterface —created instrument