$attributes * @param array $metrics */ public function record( string $type, string $source, string $priority, array $attributes = array(), array $metrics = array(), ?string $correlation_id = null ): void { try { if ( $this->enabled !== null && ! ( $this->enabled )() ) { return; } $event = Event::make( $type, $source, $priority, $attributes, $metrics, $correlation_id ); $line = wp_json_encode( $event ); if ( is_string( $line ) ) { $this->spool->append( $line, $priority ); } } catch ( \Throwable ) { // Fail open: telemetry loss is acceptable, site impact is not. } } public function spool(): SpoolInterface { return $this->spool; } }