MetricExporter
Interface for exporting metrics to external systems.
Exporters are responsible for transmitting metric data to backends like Prometheus, OTLP collectors, or custom storage systems.
Example implementation:
final class OTLPMetricExporter implements MetricExporter
{
public function export(array $metrics): bool
{
// Convert to OTLP format and send to collector
return $this->client->sendMetrics($metrics);
}
}
Methods
- export() : bool
- Export a batch of metrics.
- transports() : array<string|int, Transport>
- Get the transports used by this exporter.
Methods
export()
Export a batch of metrics.
public
export(array<string|int, Metric> $metrics) : bool
Each metric carries its own Resource and InstrumentationScope.
Parameters
- $metrics : array<string|int, Metric>
-
The metrics to export
Return values
bool —True on success, false on failure
transports()
Get the transports used by this exporter.
public
transports() : array<string|int, Transport>
Return values
array<string|int, Transport> —Always returns at least one transport