MemoryExporter implements Exporter
FinalYes
Exporter that stores telemetry batches in memory for direct access.
Useful for testing and inspection where you need direct access to exported data without serialization.
Interfaces
- Exporter
- Interface for exporting telemetry signals to external systems.
Methods
- __construct() : mixed
- export() : bool
- Export a signal batch.
- logs() : array<string|int, LogEntry>
- metrics() : array<string|int, Metric>
- reset() : void
- shutdown() : void
- Shutdown the exporter and any owned transports.
- spans() : array<string|int, Span>
Methods
__construct()
public
__construct([null|int $maxEntriesPerSignal = null ]) : mixed
Parameters
- $maxEntriesPerSignal : null|int = null
-
maximum number of entries retained per signal type; once exceeded the oldest entries are dropped. Null (default) keeps everything, which is unbounded and unsafe in long-running processes that never reset().
export()
Export a signal batch.
public
export(Signals $signal) : bool
Implementations dispatch on Signal::$type via match.
Parameters
- $signal : Signals
Return values
bool —True on success, false on failure
logs()
public
logs() : array<string|int, LogEntry>
Return values
array<string|int, LogEntry>metrics()
public
metrics() : array<string|int, Metric>
Return values
array<string|int, Metric>reset()
public
reset() : void
shutdown()
Shutdown the exporter and any owned transports.
public
shutdown() : void
Implementations MUST be idempotent and MUST NOT throw - runtime errors are routed through the configured error handler instead.
spans()
public
spans() : array<string|int, Span>