Skip to content

Sentry cannot deal with sub namespaced NamespacedPoolInterface caches #973

@Coffee2CodeNL

Description

@Coffee2CodeNL

How do you use Sentry?

Sentry SaaS (sentry.io)

SDK version

4.18.1

Bundle Version

5.6.0

Steps to reproduce

  1. 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);
    }
  1. 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".

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions