Skip to content

Fix decoration of symfony scoped http clients #704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions src/DependencyInjection/Compiler/HttpClientTracingPass.php

This file was deleted.

4 changes: 3 additions & 1 deletion src/DependencyInjection/SentryExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,9 @@ private function registerHttpClientTracingConfiguration(ContainerBuilder $contai
throw new \LogicException('Http client tracing support cannot be enabled because the symfony/http-client Composer package is not installed.');
}

$container->setParameter('sentry.tracing.http_client.enabled', $isConfigEnabled);
if (!$isConfigEnabled) {
$container->removeDefinition('sentry.tracing.traceable_http_client');
}
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,10 @@

<tag name="twig.extension" />
</service>

<service id="sentry.tracing.traceable_http_client" class="Sentry\SentryBundle\Tracing\HttpClient\TraceableHttpClient" decorates="http_client" decoration-priority="8">
<argument type="service" id="sentry.tracing.traceable_http_client.inner" />
<argument type="service" id="Sentry\State\HubInterface" />
</service>
</services>
</container>
2 changes: 0 additions & 2 deletions src/SentryBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use Sentry\SentryBundle\DependencyInjection\Compiler\CacheTracingPass;
use Sentry\SentryBundle\DependencyInjection\Compiler\DbalTracingPass;
use Sentry\SentryBundle\DependencyInjection\Compiler\HttpClientTracingPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;

Expand All @@ -22,6 +21,5 @@ public function build(ContainerBuilder $container): void

$container->addCompilerPass(new DbalTracingPass());
$container->addCompilerPass(new CacheTracingPass());
$container->addCompilerPass(new HttpClientTracingPass());
}
}
85 changes: 0 additions & 85 deletions tests/DependencyInjection/Compiler/HttpClientTracingPassTest.php

This file was deleted.

2 changes: 1 addition & 1 deletion tests/DependencyInjection/SentryExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public function testHttpClientTracingExtensionIsConfiguredWhenHttpClientTracingI

$container = $this->createContainerFromFixture('http_client_tracing_enabled');

$this->assertTrue($container->getParameter('sentry.tracing.http_client.enabled'));
$this->assertTrue($container->hasDefinition('sentry.tracing.traceable_http_client'));
}

public function testTwigTracingExtensionIsRemovedWhenTwigTracingIsDisabled(): void
Expand Down