Skip to content

Telemetry for official plugins#4

Merged
Rafikooo merged 1 commit intoSylius:mainfrom
Rafikooo:compiler-pass-approach
Feb 2, 2026
Merged

Telemetry for official plugins#4
Rafikooo merged 1 commit intoSylius:mainfrom
Rafikooo:compiler-pass-approach

Conversation

@Rafikooo
Copy link
Collaborator

@Rafikooo Rafikooo commented Feb 2, 2026

Alternative approach to #1 — uses a compiler pass instead of a bundle, so end users don't need to touch bundles.php.

Ref: Sylius/Sylius#18588

Uses a compiler pass that plugins register in their build() method. When SyliusCoreExtension skips loading telemetry services (because the user disabled telemetry via ENV or config), the compiler pass loads them directly from SyliusCoreBundle.

This approach requires no action from end users — no bundles.php changes, no Flex recipe. The plugin's composer require sylius/telemetry + compiler pass registration is enough.

How it works

  1. If telemetry services are already in the container → noop
  2. If Sylius version predates telemetry (TelemetrySendManagerInterface doesn't exist) → noop
  3. If dev/test environment → noop
  4. Otherwise → loads all config files from SyliusCoreBundle/Resources/config/services/telemetry/ via DirectoryLoader (supports both XML and PHP formats)

Usage in a plugin

use Sylius\Telemetry\TelemetryCompilerPass;

final class FooPlugin extends Bundle
{
    public function build(ContainerBuilder $container): void
    {
        $container->addCompilerPass(new TelemetryCompilerPass());
    }
}

@Rafikooo Rafikooo changed the title Replace bundle with compiler pass for zero user friction Telemetry for official plugins Feb 2, 2026
@Rafikooo Rafikooo force-pushed the compiler-pass-approach branch 5 times, most recently from f559c96 to 3a5efb7 Compare February 2, 2026 12:42
@Rafikooo Rafikooo force-pushed the compiler-pass-approach branch from 3a5efb7 to 987733e Compare February 2, 2026 13:01
@Rafikooo Rafikooo merged commit 64061cd into Sylius:main Feb 2, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant