MemoryMetricProcessor implements MetricProcessor
FinalYes
Processor that stores metrics in memory and exports via configured exporter.
Interfaces
- MetricProcessor
- Interface for processing metric measurements.
Methods
- __construct() : mixed
- countMetrics() : int
- Get the total number of recorded metrics.
- exporter() : MetricExporter
- Get the exporter used by this processor.
- flush() : bool
- Export all pending metrics.
- metrics() : array<string|int, Metric>
- Get all recorded metrics.
- metricsOfType() : array<string|int, Metric>
- Get all metrics of a specific type.
- metricsWithName() : array<string|int, Metric>
- Get all metrics with a specific name.
- process() : void
- Process a metric measurement.
- reset() : void
- Reset all stored data.
Methods
__construct()
public
__construct(MetricExporter $metricExporter) : mixed
Parameters
- $metricExporter : MetricExporter
countMetrics()
Get the total number of recorded metrics.
public
countMetrics() : int
Return values
intexporter()
Get the exporter used by this processor.
public
exporter() : MetricExporter
Return values
MetricExporterflush()
Export all pending metrics.
public
flush() : bool
Forces immediate export of any buffered metrics.
Return values
bool —True if all metrics were successfully exported
metrics()
Get all recorded metrics.
public
metrics() : array<string|int, Metric>
Return values
array<string|int, Metric>metricsOfType()
Get all metrics of a specific type.
public
metricsOfType(MetricType $type) : array<string|int, Metric>
Parameters
- $type : MetricType
Return values
array<string|int, Metric>metricsWithName()
Get all metrics with a specific name.
public
metricsWithName(string $name) : array<string|int, Metric>
Parameters
- $name : string
Return values
array<string|int, Metric>process()
Process a metric measurement.
public
process(Metric $metric) : void
This is invoked when an instrument records a value. The processor may buffer the metric, export it immediately, or discard it based on filtering rules.
Parameters
- $metric : Metric
reset()
Reset all stored data.
public
reset() : void