Skip to content

Commit 9e101ad

Browse files
Fix the auto-detection of the Cache component to enable performance tracing (#501)
1 parent 1a4080a commit 9e101ad

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Fix the CacheItem detection for tracing (#501)
6+
57
## 4.1.1 (2021-05-10)
68

79
- Fix the conditions to automatically enable the cache instrumentation when possible (#487)

src/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ private function addDistributedTracingSection(ArrayNodeDefinition $rootNode): vo
165165
->{class_exists(TwigBundle::class) ? 'canBeDisabled' : 'canBeEnabled'}()
166166
->end()
167167
->arrayNode('cache')
168-
->{interface_exists(CacheItem::class) ? 'canBeDisabled' : 'canBeEnabled'}()
168+
->{class_exists(CacheItem::class) ? 'canBeDisabled' : 'canBeEnabled'}()
169169
->end()
170170
->end()
171171
->end()

src/DependencyInjection/SentryExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ private function registerCacheTracingConfiguration(ContainerBuilder $container,
224224
$isConfigEnabled = $this->isConfigEnabled($container, $config)
225225
&& $this->isConfigEnabled($container, $config['cache']);
226226

227-
if ($isConfigEnabled && !interface_exists(CacheItem::class)) {
227+
if ($isConfigEnabled && !class_exists(CacheItem::class)) {
228228
throw new LogicException('Cache tracing support cannot be enabled because the symfony/cache Composer package is not installed.');
229229
}
230230

tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function testProcessConfigurationWithDefaultConfiguration(): void
4848
'enabled' => class_exists(TwigBundle::class),
4949
],
5050
'cache' => [
51-
'enabled' => interface_exists(CacheItem::class),
51+
'enabled' => class_exists(CacheItem::class),
5252
],
5353
],
5454
];

0 commit comments

Comments
 (0)