From 9b98d5516e80d3715f15a276ff86a4285a1c6280 Mon Sep 17 00:00:00 2001 From: "kirill.bor" Date: Thu, 5 Dec 2024 13:57:38 +0300 Subject: [PATCH 1/2] added compatibility with non default redis manager (which has implemented RedisFactory interface) --- src/Sentry/Laravel/Features/CacheIntegration.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Sentry/Laravel/Features/CacheIntegration.php b/src/Sentry/Laravel/Features/CacheIntegration.php index bef61565..17651925 100644 --- a/src/Sentry/Laravel/Features/CacheIntegration.php +++ b/src/Sentry/Laravel/Features/CacheIntegration.php @@ -5,7 +5,7 @@ use Illuminate\Cache\Events; use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Redis\Events as RedisEvents; -use Illuminate\Redis\RedisManager; +use Illuminate\Contracts\Redis\Factory as RedisFactoryContract; use Illuminate\Support\Str; use Sentry\Breadcrumb; use Sentry\Laravel\Features\Concerns\ResolvesEventOrigin; @@ -60,7 +60,7 @@ public function onBoot(Dispatcher $events): void if ($this->isTracingFeatureEnabled('redis_commands', false)) { $events->listen(RedisEvents\CommandExecuted::class, [$this, 'handleRedisCommands']); - $this->container()->afterResolving(RedisManager::class, static function (RedisManager $redis): void { + $this->container()->afterResolving(RedisFactoryContract::class, static function (RedisFactoryContract $redis): void { $redis->enableEvents(); }); } From d9b31a3853836cd6596b5cc3ae54aab9581ca754 Mon Sep 17 00:00:00 2001 From: "kirill.bor" Date: Thu, 5 Dec 2024 16:02:09 +0300 Subject: [PATCH 2/2] omit type declaration, back it in phpdoc --- src/Sentry/Laravel/Features/CacheIntegration.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Sentry/Laravel/Features/CacheIntegration.php b/src/Sentry/Laravel/Features/CacheIntegration.php index 17651925..3106cd7c 100644 --- a/src/Sentry/Laravel/Features/CacheIntegration.php +++ b/src/Sentry/Laravel/Features/CacheIntegration.php @@ -6,6 +6,7 @@ use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Redis\Events as RedisEvents; use Illuminate\Contracts\Redis\Factory as RedisFactoryContract; +use Illuminate\Redis\RedisManager; use Illuminate\Support\Str; use Sentry\Breadcrumb; use Sentry\Laravel\Features\Concerns\ResolvesEventOrigin; @@ -60,7 +61,8 @@ public function onBoot(Dispatcher $events): void if ($this->isTracingFeatureEnabled('redis_commands', false)) { $events->listen(RedisEvents\CommandExecuted::class, [$this, 'handleRedisCommands']); - $this->container()->afterResolving(RedisFactoryContract::class, static function (RedisFactoryContract $redis): void { + $this->container()->afterResolving(RedisFactoryContract::class, static function ($redis): void { + /** @var RedisManager $redis */ $redis->enableEvents(); }); }