sentry-symfony
sentry-symfony copied to clipboard
Sentry cannot deal with sub namespaced NamespacedPoolInterface caches
How do you use Sentry?
Sentry SaaS (sentry.io)
SDK version
4.18.1
Bundle Version
5.6.0
Steps to reproduce
- Inject cache like so
/** @var CacheInterface&NamespacedPoolInterface&TagAwareCacheInterface */
private readonly CacheInterface $cache;
/**
* @param CacheInterface&NamespacedPoolInterface&TagAwareCacheInterface $cache
*
* @throws InvalidArgumentException
*/
public function __construct(
#[Autowire(service: 'cache.custom_pool')]
CacheInterface $cache,
) {
$this->cache = $cache->withSubNameSpace(PriceFilter::class);
}
- retrieve something from cache like so
$this->cache->get('a_cache_key', function (ItemInterface $item) {
$item->tag(['a tag name']);
return $this->getDataFromDatabase();
});
Expected result
Not get an error when creating a subnamespaced cache
Actual result
Cannot call "Sentry\SentryBundle\Tracing\Cache\TraceableTagAwareCacheAdapterForV3::withSubNamespace()": this class doesn't implement "Symfony\Contracts\Cache\NamespacedPoolInterface".
Hi @Coffee2CodeNL! Thanks for opening the issue!
Seems like this was added relatively recent (Mai 2025) so we haven't added support yet. Since this looks rather easy to add, I will aim to add it next week
@Litarnus how is this coming along?
We have https://github.com/getsentry/sentry-symfony/issues/973 open.