From b4065f53b69aa482f970a3015590d79630dc521d Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Thu, 12 Oct 2023 15:56:41 +1100 Subject: [PATCH 1/2] Ignore timers --- src/Recorders/CacheInteractions.php | 5 ++++- tests/Feature/CacheInteractionsTest.php | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Recorders/CacheInteractions.php b/src/Recorders/CacheInteractions.php index 39c37ef2..912740fd 100644 --- a/src/Recorders/CacheInteractions.php +++ b/src/Recorders/CacheInteractions.php @@ -48,7 +48,10 @@ public function record(CacheHit|CacheMissed $event): ?Entry { $now = new CarbonImmutable(); - if (Str::startsWith($event->key, ['illuminate:', 'laravel:pulse:'])) { + if ( + Str::startsWith($event->key, ['illuminate:', 'laravel:pulse:']) || + Str::endsWith($event->key, ':timer') + ) { return null; } diff --git a/tests/Feature/CacheInteractionsTest.php b/tests/Feature/CacheInteractionsTest.php index be298cf5..b282a462 100644 --- a/tests/Feature/CacheInteractionsTest.php +++ b/tests/Feature/CacheInteractionsTest.php @@ -40,6 +40,14 @@ expect($interactions)->toHaveCount(0); }); +it('ignores internal illuminate timer interactions interactions', function () { + Cache::get('foo:timer'); + Pulse::store(app(Ingest::class)); + + $interactions = Pulse::ignore(fn () => DB::table('pulse_cache_interactions')->get()); + expect($interactions)->toHaveCount(0); +}); + it('ignores internal pulse cache interactions', function () { Cache::get('laravel:pulse:foo'); Pulse::store(app(Ingest::class)); From 38a37a5943ed7d1a67c2bbfe2e7892238673c55a Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Thu, 12 Oct 2023 16:16:40 +1100 Subject: [PATCH 2/2] Ignore nova --- src/Recorders/CacheInteractions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Recorders/CacheInteractions.php b/src/Recorders/CacheInteractions.php index 912740fd..6b9f278d 100644 --- a/src/Recorders/CacheInteractions.php +++ b/src/Recorders/CacheInteractions.php @@ -49,7 +49,7 @@ public function record(CacheHit|CacheMissed $event): ?Entry $now = new CarbonImmutable(); if ( - Str::startsWith($event->key, ['illuminate:', 'laravel:pulse:']) || + Str::startsWith($event->key, ['illuminate:', 'laravel:pulse:', 'nova.metric.']) || Str::endsWith($event->key, ':timer') ) { return null;