ConditionalExporter implements Exporter
Read onlyYes
FinalYes
Gates a wrapped exporter behind a runtime flag. When disabled, batches are dropped without reaching the wrapped exporter, while callers still observe a successful export. Enables toggling export on or off via configuration (including environment variables) without rewiring the container.
Interfaces
- Exporter
- Interface for exporting telemetry signals to external systems.
Methods
- __construct() : mixed
- export() : bool
- Export a signal batch.
- shutdown() : void
- Shutdown the exporter and any owned transports.
Methods
__construct()
public
__construct(bool $enabled, Exporter $exporter) : mixed
Parameters
- $enabled : bool
- $exporter : Exporter
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
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.