Open Chris53897 opened 9 months ago
Ah yes, this is a bit tricky and we'll have to make a decision on "where the config should live".
Option 1 - Config lives in liip_monitor: For this, we'd need a way to bundles (like this one), to announce to LiipMonitorBundle that it has a configurable check. I do something similar in ZenstruckBackupBundle but it isn't extensible (the extra config options are hard-coded). What we need is sort of a pre-compile container that has the liip_monitor check config factories tagged. I'm not sure this is possible - we might have to use composer.json config - in LiipMonitorBundle's extension, look for all installed packages that have a specific key in their composer.json. This will probably get complex...
Option 2 - Config lives in this bundle: For this, we'd add a liip_monitor key to this bundle's config that's only available when LiipMonitorBundle is enabled. You can then have WorkerRunningCheck
implement Liip\Monitor\DependencyInjection\ConfigurableCheck
but we'd have to add the config manually to this bundle.
Option 1 seems ideal but 2 seems easiest.
Thanks for the info. I will have a deeper look, as soon i have some free time.
If someone is interested in a quick solution in userland code. I added a check via https://github.com/ohdearapp/health-check-results
use Zenstruck\Messenger\Monitor\Twig\ViewHelper;
public function __construct(private readonly ViewHelper $viewHelper)
{}
...
$amountWorkers = $this->viewHelper->workers->count();
if($amountWorkers == 0)
{
$checkResult = new CheckResult(
name: 'SymfonyMessengerWorker',
label: 'Running SymfonyMessengerWorker',
notificationMessage: 'There are '.$amountWorkers.' workers running',
shortSummary: $amountWorkers.' running',
status: CheckResult::STATUS_FAILED,
meta: ['workers' => $amountWorkers]
);
$checkResults->addCheckResult($checkResult);
}
i try to add checks for LiipMonitoring-Bundle https://github.com/zenstruck/messenger-monitor-bundle/issues/11
But i am a bit stucked here.
I followed the example from here https://github.com/kbond/LiipMonitorBundle/tree/feat/ohdear#custom-checks and took this Check as example https://github.com/kbond/LiipMonitorBundle/blob/feat/ohdear/src/Check/Symfony/SymfonyVersionCheck.php
I thought i could activated it like this.
And see it with
php bin/console monitor:list
But i will get an error, that
symfony_worker_running
is not registered unterchecks
.@kbond Maybe you can give me a little push to the right direction?