PassThroughMetricProcessor implements MetricProcessor
Read onlyYes
FinalYes
Exports each metric immediately when processed.
Unlike BatchingMetricProcessor, this processor exports metrics synchronously one at a time. This is useful for debugging and development where immediate visibility of metrics is more important than performance.
Example usage:
$processor = new PassThroughMetricProcessor($metricExporter);
Interfaces
- MetricProcessor
- Interface for processing metric measurements.
Methods
- __construct() : mixed
- exporter() : MetricExporter
- Get the exporter used by this processor.
- flush() : bool
- Export all pending metrics.
- process() : void
- Process a metric measurement.
Methods
__construct()
public
__construct(MetricExporter $exporter) : mixed
Parameters
- $exporter : MetricExporter
exporter()
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
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