diff --git a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php index 08f9930a81b2f..5ae98e49de3fb 100644 --- a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php +++ b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php @@ -1,9 +1,7 @@ logger->debug('cache_invalidate: ', $this->makeParams($invalidateInfo)); + $context = $this->makeParams($invalidateInfo); + if (isset($invalidateInfo['tags'], $invalidateInfo['mode'])) { + if ($invalidateInfo['mode'] === 'all' + && is_array($invalidateInfo['tags']) + && empty($invalidateInfo['tags']) + ) { + // If we are sending a purge request to all cache storage capture the trace + // This is not a usual flow, and likely a bug is causing a performance issue + $context['trace'] = (string)(new \Exception('full purge of cache storage triggered')); + } + } + $this->logger->debug('cache_invalidate: ', $context); } /**