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
- flush() : bool
- Export all pending metrics.
- metrics() : array<string|int, Metric>
- metricsOfType() : array<string|int, Metric>
- metricsWithName() : array<string|int, Metric>
- process() : void
- Process a metric measurement.
- reset() : void
- shutdown() : void
- Shutdown the processor.
Methods
__construct()
public
__construct(Exporter $metricExporter[, ErrorHandler $errorHandler = new ErrorLogHandler() ]) : mixed
Parameters
- $metricExporter : Exporter
- $errorHandler : ErrorHandler = new ErrorLogHandler()
countMetrics()
public
countMetrics() : int
Return values
intflush()
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()
public
metrics() : array<string|int, Metric>
Return values
array<string|int, Metric>metricsOfType()
public
metricsOfType(MetricType $type) : array<string|int, Metric>
Parameters
- $type : MetricType
Return values
array<string|int, Metric>metricsWithName()
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()
public
reset() : void
shutdown()
Shutdown the processor.
public
shutdown() : void
Implementations SHOULD flush() pending data before delegating shutdown to the underlying exporter. MUST be idempotent and MUST NOT throw.