Skip to content

Commit

Permalink
remove experimental trace feature
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBadura committed Dec 12, 2024
1 parent 28b65ef commit b701062
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 263 deletions.
10 changes: 1 addition & 9 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
* snapshot_stores: array<string, array{type: string, service: string}>,
* migration: array{path: string, namespace: string},
* cryptography: array{enabled: bool, algorithm: string},
* clock: array{freeze: ?string, service: ?string},
* debug: array{trace: bool}
* clock: array{freeze: ?string, service: ?string}
* }
*/
final class Configuration implements ConfigurationInterface
Expand Down Expand Up @@ -205,13 +204,6 @@ public function getConfigTreeBuilder(): TreeBuilder
->scalarNode('algorithm')->defaultValue('aes256')->end()
->end()
->end()

->arrayNode('debug')
->addDefaultsIfNotSet()
->children()
->booleanNode('trace')->defaultFalse()->end()
->end()
->end()
->end();
// @codingStandardsIgnoreEnd

Expand Down
53 changes: 0 additions & 53 deletions src/DependencyInjection/PatchlevelEventSourcingExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
use Patchlevel\EventSourcing\Console\Command\WatchCommand;
use Patchlevel\EventSourcing\Console\DoctrineHelper;
use Patchlevel\EventSourcing\Cryptography\DoctrineCipherKeyStore;
use Patchlevel\EventSourcing\Debug\Trace\TraceableSubscriberAccessorRepository;
use Patchlevel\EventSourcing\Debug\Trace\TraceDecorator;
use Patchlevel\EventSourcing\Debug\Trace\TraceStack;
use Patchlevel\EventSourcing\EventBus\AttributeListenerProvider;
use Patchlevel\EventSourcing\EventBus\Consumer;
use Patchlevel\EventSourcing\EventBus\DefaultConsumer;
Expand Down Expand Up @@ -112,7 +109,6 @@
use Patchlevel\EventSourcingBundle\EventBus\SymfonyEventBus;
use Patchlevel\EventSourcingBundle\RequestListener\AutoSetupListener;
use Patchlevel\EventSourcingBundle\RequestListener\SubscriptionRebuildAfterFileChangeListener;
use Patchlevel\EventSourcingBundle\RequestListener\TraceListener;
use Patchlevel\EventSourcingBundle\ValueResolver\AggregateRootIdValueResolver;
use Patchlevel\Hydrator\Cryptography\Cipher\Cipher;
use Patchlevel\Hydrator\Cryptography\Cipher\CipherKeyFactory;
Expand Down Expand Up @@ -166,7 +162,6 @@ public function load(array $configs, ContainerBuilder $container): void
$this->configureSchema($config, $container);
$this->configureSubscription($config, $container);
$this->configureCryptography($config, $container);
$this->configureDebugging($config, $container);
$this->configureMigration($config, $container);
$this->configureValueResolver($container);
}
Expand Down Expand Up @@ -898,54 +893,6 @@ private function configureCryptography(array $config, ContainerBuilder $containe
$container->setAlias(PayloadCryptographer::class, PersonalDataPayloadCryptographer::class);
}

/** @param Config $config */
private function configureDebugging(array $config, ContainerBuilder $container): void
{
if (!$config['debug']['trace']) {
return;
}

$container->register(TraceStack::class);

$container->register(TraceDecorator::class)
->setArguments([
new Reference(TraceStack::class),
])
->addTag('event_sourcing.message_decorator');

$container->register(TraceableSubscriberAccessorRepository::class)
->setDecoratedService(SubscriberAccessorRepository::class)
->setArguments([
new Reference('.inner'),
new Reference(TraceStack::class),
]);

$container->register(TraceListener::class)
->setArguments([
new Reference(TraceStack::class),
])
->addTag('kernel.event_listener', [
'priority' => 0,
'event' => 'console.command',
'method' => 'onConsoleCommand',
])
->addTag('kernel.event_listener', [
'priority' => 0,
'event' => 'console.terminate',
'method' => 'onConsoleTerminate',
])
->addTag('kernel.event_listener', [
'priority' => 0,
'event' => 'kernel.request',
'method' => 'onRequest',
])
->addTag('kernel.event_listener', [
'priority' => 0,
'event' => 'kernel.response',
'method' => 'onResponse',
]);
}

private function configureValueResolver(ContainerBuilder $container): void
{
$container->register(AggregateRootIdValueResolver::class)
Expand Down
38 changes: 0 additions & 38 deletions src/DependencyInjection/TraceCompilerPass.php

This file was deleted.

47 changes: 0 additions & 47 deletions src/Messenger/TraceHandlersLocator.php

This file was deleted.

2 changes: 0 additions & 2 deletions src/PatchlevelEventSourcingBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@

use Patchlevel\EventSourcingBundle\DependencyInjection\RepositoryCompilerPass;
use Patchlevel\EventSourcingBundle\DependencyInjection\SubscriberGuardCompilePass;
use Patchlevel\EventSourcingBundle\DependencyInjection\TraceCompilerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

final class PatchlevelEventSourcingBundle extends Bundle
{
public function build(ContainerBuilder $container): void
{
$container->addCompilerPass(new TraceCompilerPass());
$container->addCompilerPass(new RepositoryCompilerPass());
$container->addCompilerPass(new SubscriberGuardCompilePass());
}
Expand Down
86 changes: 0 additions & 86 deletions src/RequestListener/TraceListener.php

This file was deleted.

28 changes: 0 additions & 28 deletions tests/Unit/PatchlevelEventSourcingBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
use Patchlevel\EventSourcing\Console\Command\SubscriptionStatusCommand;
use Patchlevel\EventSourcing\Console\Command\SubscriptionTeardownCommand;
use Patchlevel\EventSourcing\Console\Command\WatchCommand;
use Patchlevel\EventSourcing\Debug\Trace\TraceStack;
use Patchlevel\EventSourcing\EventBus\DefaultEventBus;
use Patchlevel\EventSourcing\EventBus\EventBus;
use Patchlevel\EventSourcing\EventBus\Psr14EventBus;
Expand Down Expand Up @@ -938,9 +937,6 @@ public function testCryptography(): void
'connection' => [
'service' => 'doctrine.dbal.eventstore_connection',
],
'debug' => [
'trace' => true,
],
'cryptography' => [
'algorithm' => 'aes256',
],
Expand All @@ -951,27 +947,6 @@ public function testCryptography(): void
self::assertInstanceOf(PersonalDataPayloadCryptographer::class, $container->get(PayloadCryptographer::class));
}

public function testTrace(): void
{
$container = new ContainerBuilder();

$this->compileContainer(
$container,
[
'patchlevel_event_sourcing' => [
'connection' => [
'service' => 'doctrine.dbal.eventstore_connection',
],
'debug' => [
'trace' => true,
],
],
]
);

self::assertInstanceOf(TraceStack::class, $container->get(TraceStack::class));
}

public function testFullBuild(): void
{
$psrClock = $this->prophesize(ClockInterface::class)->reveal();
Expand Down Expand Up @@ -1011,9 +986,6 @@ public function testFullBuild(): void
'cryptography' => [
'algorithm' => 'aes256',
],
'debug' => [
'trace' => true,
],
'subscription' => [
'catch_up' => [
'limit' => 10,
Expand Down

0 comments on commit b701062

Please sign in to comment.