Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/ignore unknown queue counts #284

Merged
merged 2 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Command/UpdateComposerPluginsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class UpdateComposerPluginsCommand extends Command
private readonly Application $application;

public function __construct(
#[Autowire('%kernel.project_dir%')]
#[Autowire(param: 'kernel.project_dir')]
private readonly string $projectDir,
private readonly KernelPluginLoader $pluginLoader,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
use Symfony\Component\HttpKernel\Event\ResponseEvent;

#[AutoconfigureTag('kernel.event_listener')]
final class AdminInfoSubscriberEventListener
final readonly class AdminInfoSubscriberEventListener
{
public function __construct(
#[Autowire('%frosh_tools.elasticsearch.enabled%')]
private readonly bool $elasticsearchEnabled,
#[Autowire(param: 'frosh_tools.elasticsearch.enabled')]
private bool $elasticsearchEnabled,
) {}

public function __invoke(ResponseEvent $event): void
{
if ($event->getRequest()->attributes->get('_route') !== 'api.info.config') {
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Elasticsearch/ElasticsearchManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ElasticsearchManager
{
public function __construct(
private readonly Client $client,
#[Autowire('%frosh_tools.elasticsearch.enabled%')]
#[Autowire(param: 'frosh_tools.elasticsearch.enabled')]
private readonly bool $enabled,
private readonly ElasticsearchIndexer $indexer,
private readonly MessageBusInterface $messageBus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class ProductionChecker implements HealthCheckerInterface, CheckerInterface
{
public function __construct(
#[Autowire('%kernel.environment%')]
#[Autowire(param: 'kernel.environment')]
private readonly string $environment,
) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SwagSecurityChecker implements HealthCheckerInterface, CheckerInterface
public function __construct(
private readonly Connection $connection,
private readonly KernelInterface $kernel,
#[Autowire('%kernel.shopware_version%')]
#[Autowire(param: 'kernel.shopware_version')]
private readonly string $shopwareVersion,
private readonly CacheInterface $cacheObject,
#[Autowire(lazy: true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class SystemInfoChecker implements HealthCheckerInterface, CheckerInterface
{
public function __construct(
#[Autowire('%kernel.project_dir%')]
#[Autowire(param: 'kernel.project_dir')]
private readonly string $projectDir,
) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class AdminWorkerChecker implements PerformanceCheckerInterface, CheckerInterface
{
public function __construct(
#[Autowire('%shopware.admin_worker.enable_admin_worker%')]
#[Autowire(param: 'shopware.admin_worker.enable_admin_worker')]
private readonly bool $adminWorkerEnabled,
) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ class CompressionMethodChecker implements PerformanceCheckerInterface, CheckerIn
public const DOCUMENTATION_URL = 'https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#using-zstd-instead-of-gzip-for-compression';

public function __construct(
#[Autowire('%kernel.shopware_version%')]
#[Autowire(param: 'kernel.shopware_version')]
public readonly string $shopwareVersion,
#[Autowire('%shopware.cache.cache_compression%')]
#[Autowire(param: 'shopware.cache.cache_compression')]
public readonly bool $cacheCompressionEnabled,
#[Autowire('%shopware.cache.cache_compression_method%')]
#[Autowire(param: 'shopware.cache.cache_compression_method')]
public readonly string $cacheCompressionMethod,
#[Autowire('%shopware.cart.compress%')]
#[Autowire(param: 'shopware.cart.compress')]
public readonly bool $cartCompressionEnabled,
#[Autowire('%shopware.cart.compression_method%')]
#[Autowire(param: 'shopware.cart.compression_method')]
public readonly string $cartCompressionMethod,
) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class FixCacheIdSetChecker implements PerformanceCheckerInterface, CheckerInterface
{
public function __construct(
#[Autowire('%kernel.shopware_version%')]
#[Autowire(param: 'kernel.shopware_version')]
protected string $shopwareVersion,
) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
class IncrementStorageChecker implements PerformanceCheckerInterface, CheckerInterface
{
public function __construct(
#[Autowire('%shopware.increment.user_activity.type%')]
#[Autowire(param: 'shopware.increment.user_activity.type')]
private readonly string $userActivity,
#[Autowire('%shopware.increment.message_queue.type%')]
#[Autowire(param: 'shopware.increment.message_queue.type')]
private readonly string $queueActivity,
) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class MailOverQueueChecker implements PerformanceCheckerInterface, CheckerInterface
{
public function __construct(
#[Autowire('%frosh_tools.mail_over_queue%')]
#[Autowire(param: 'frosh_tools.mail_over_queue')]
protected bool $mailerIsOverQueue,
) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class QueueConnectionChecker implements PerformanceCheckerInterface, CheckerInterface
{
public function __construct(
#[Autowire('%frosh_tools.queue_connection%')]
#[Autowire(param: 'frosh_tools.queue_connection')]
protected string $connection,
) {}

Expand Down
4 changes: 2 additions & 2 deletions src/Components/StateMachines/Mermaid.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
use Twig\Environment;
use Twig\Loader\FilesystemLoader;

final class Mermaid implements ExportInterface
final readonly class Mermaid implements ExportInterface
{
private const DEFAULT_PATH = __DIR__ . '/../../Resources/views/administration/mermaid';

private readonly Environment $twig;
private Environment $twig;

public function __construct()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Components/StateMachines/Plantuml.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
use Twig\Environment;
use Twig\Loader\FilesystemLoader;

final class Plantuml implements ExportInterface
final readonly class Plantuml implements ExportInterface
{
private const DEFAULT_PATH = __DIR__ . '/../../Resources/views/administration/plantuml';

private readonly Environment $twig;
private Environment $twig;

public function __construct()
{
Expand Down
5 changes: 3 additions & 2 deletions src/Components/SystemConfig/ConfigSystemConfigLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@

namespace Frosh\Tools\Components\SystemConfig;

use Shopware\Core\System\SystemConfig\SystemConfigLoader;
use Shopware\Core\System\SystemConfig\AbstractSystemConfigLoader;
use Symfony\Component\DependencyInjection\Attribute\AsDecorator;
use Symfony\Component\DependencyInjection\Attribute\Autowire;

#[AsDecorator(
decorates: 'Shopware\Core\System\SystemConfig\SystemConfigLoader',
decorates: SystemConfigLoader::class,
priority: 2000,
)]
class ConfigSystemConfigLoader extends AbstractSystemConfigLoader
{
/**
* @param array<string, array<array<mixed>|bool|float|int|string|null>> $config
*/
public function __construct(private readonly AbstractSystemConfigLoader $decorated, #[Autowire('%frosh_tools.system_config%')] private readonly array $config) {}
public function __construct(private readonly AbstractSystemConfigLoader $decorated, #[Autowire(param: 'frosh_tools.system_config')] private readonly array $config) {}

public function getDecorated(): AbstractSystemConfigLoader
{
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/CacheController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;

#[Route(path: '/api/_action/frosh-tools', defaults: ['_routeScope' => ['api'], '_acl' => ['frosh_tools:read']])]
class CacheController extends AbstractController
{
public function __construct(
#[Autowire('%kernel.cache_dir%')]
#[Autowire(param: 'kernel.cache_dir')]
private readonly string $cacheDir,
private readonly CacheRegistry $cacheRegistry,
) {}
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/ElasticsearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;

#[Route(path: '/api/_action/frosh-tools/elasticsearch', defaults: ['_routeScope' => ['api'], '_acl' => ['frosh_tools:read']])]
class ElasticsearchController extends AbstractController
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/HealthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\Attribute\TaggedIterator;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;

#[Route(path: '/api/_action/frosh-tools', defaults: ['_routeScope' => ['api'], '_acl' => ['frosh_tools:read']])]
class HealthController extends AbstractController
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/LogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;

#[Route(path: '/api/_action/frosh-tools', defaults: ['_routeScope' => ['api'], '_acl' => ['frosh_tools:read']])]
class LogController extends AbstractController
Expand All @@ -23,7 +23,7 @@ class LogController extends AbstractController
private readonly string $logDir;

public function __construct(
#[Autowire('%kernel.logs_dir%')]
#[Autowire(param: 'kernel.logs_dir')]
string $logDir,
) {
$this->logDir = rtrim($logDir, '/') . '/';
Expand Down
7 changes: 1 addition & 6 deletions src/Controller/QueueController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Messenger\Transport\Receiver\MessageCountAwareInterface;
use Symfony\Component\Messenger\Transport\Receiver\ReceiverInterface;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;

#[Route(path: '/api/_action/frosh-tools', defaults: ['_routeScope' => ['api'], '_acl' => ['frosh_tools:read']])]
class QueueController extends AbstractController
Expand Down Expand Up @@ -69,11 +69,6 @@ private function getMessengerStats(array &$queueData): void

$transport = $this->transportLocator->get($transportName);
if (!$transport instanceof MessageCountAwareInterface) {
$queueData[] = [
'name' => $transportName,
'size' => 'unknown',
];

continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Controller/ScheduledTaskController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;

#[Route(path: '/api/_action/frosh-tools', defaults: ['_routeScope' => ['api'], '_acl' => ['frosh_tools:read']])]
class ScheduledTaskController extends AbstractController
Expand Down
8 changes: 4 additions & 4 deletions src/Controller/ShopwareFilesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Contracts\HttpClient\HttpClientInterface;

#[AutoconfigureTag('monolog.logger', ['channel' => 'frosh-tools'])]
Expand All @@ -38,11 +38,11 @@ class ShopwareFilesController extends AbstractController
* @param EntityRepository<IntegrationCollection> $integrationRepository
*/
public function __construct(
#[Autowire('%kernel.shopware_version%')]
#[Autowire(param: 'kernel.shopware_version')]
private readonly string $shopwareVersion,
#[Autowire('%kernel.project_dir%')]
#[Autowire(param: 'kernel.project_dir')]
private readonly string $projectDir,
#[Autowire('%frosh_tools.file_checker.exclude_files%')]
#[Autowire(param: 'frosh_tools.file_checker.exclude_files')]
private readonly array $projectExcludeFiles,
private readonly LoggerInterface $froshToolsLogger,
private readonly EntityRepository $userRepository,
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/StateMachineController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Attribute\Route;
use Shopware\Core\Framework\Uuid\Uuid;
use Shopware\Core\System\StateMachine\StateMachineEntity;

Expand Down