Monitoring (R5.3): Betriebs-Alerts fuer Scheduler-/Queue-Ausfaelle
OperationalAlert loggt critical + Best-Effort-Mail an MONITORING_ALERT_EMAIL (Fallback LEGAL_CONTACT_EMAIL, feature-flagged). Alle 6 Scheduler-Tasks mit onFailure, Queue::failing-Listener; .env.example: LOG_STACK=daily als Prod-Soll. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ac870a4076
commit
6984846233
8 changed files with 250 additions and 6 deletions
|
|
@ -6,6 +6,8 @@ use App\Console\Commands\PurgeExpiredPressReleaseDrafts;
|
|||
use App\Console\Commands\PurgeMagicLinks;
|
||||
use App\Console\Commands\RefreshMarketData;
|
||||
use App\Console\Commands\ResetMonthlyPressReleaseQuota;
|
||||
use App\Support\OperationalAlert;
|
||||
use Illuminate\Console\Scheduling\Event;
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Schedule;
|
||||
|
|
@ -14,6 +16,17 @@ Artisan::command('inspire', function () {
|
|||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
||||
|
||||
/**
|
||||
* Betriebs-Alert bei fehlgeschlagenem Scheduler-Task (R5.3): meldet den Task
|
||||
* per Log + Best-Effort-Mail, damit ein stiller Ausfall (z. B. Rechnungslauf,
|
||||
* Kontingent-Reset) nicht unbemerkt bleibt.
|
||||
*/
|
||||
$alertOnFailure = fn (string $task) => function (Event $event) use ($task): void {
|
||||
OperationalAlert::send("Geplanter Task fehlgeschlagen: {$task}", [
|
||||
'exit_code' => $event->exitCode,
|
||||
]);
|
||||
};
|
||||
|
||||
// ========================================
|
||||
// Tägliche Bereinigungen
|
||||
// ========================================
|
||||
|
|
@ -22,7 +35,8 @@ Artisan::command('inspire', function () {
|
|||
Schedule::command(PurgeMagicLinks::class, ['--days=30'])
|
||||
->dailyAt('03:00')
|
||||
->withoutOverlapping()
|
||||
->runInBackground();
|
||||
->runInBackground()
|
||||
->onFailure($alertOnFailure('magic-links:purge'));
|
||||
|
||||
// PM-Entwürfe: Zombie-Drafts nach 180 Tagen Inaktivität archivieren (wöchentlich)
|
||||
Schedule::command(PurgeExpiredPressReleaseDrafts::class, ['--days=180'])
|
||||
|
|
@ -30,7 +44,8 @@ Schedule::command(PurgeExpiredPressReleaseDrafts::class, ['--days=180'])
|
|||
->sundays()
|
||||
->at('04:00')
|
||||
->withoutOverlapping()
|
||||
->runInBackground();
|
||||
->runInBackground()
|
||||
->onFailure($alertOnFailure('press-releases:purge-drafts'));
|
||||
|
||||
// ========================================
|
||||
// Geplante PM-Veröffentlichung
|
||||
|
|
@ -41,7 +56,8 @@ Schedule::command(PurgeExpiredPressReleaseDrafts::class, ['--days=180'])
|
|||
Schedule::command(PublishScheduledPressReleases::class)
|
||||
->everyFiveMinutes()
|
||||
->withoutOverlapping()
|
||||
->runInBackground();
|
||||
->runInBackground()
|
||||
->onFailure($alertOnFailure('press-releases:publish-scheduled'));
|
||||
|
||||
// ========================================
|
||||
// Manueller Rechnungskreis (MAN-) — Legacy-Zahlungen
|
||||
|
|
@ -53,7 +69,8 @@ Schedule::command(PublishScheduledPressReleases::class)
|
|||
Schedule::command(GenerateManualInvoices::class)
|
||||
->dailyAt('04:30')
|
||||
->withoutOverlapping()
|
||||
->runInBackground();
|
||||
->runInBackground()
|
||||
->onFailure($alertOnFailure('billing:generate-manual-invoices'));
|
||||
|
||||
// ========================================
|
||||
// PM-Kontingent (Kalendermonats-Reset des Tarif-Modells)
|
||||
|
|
@ -63,7 +80,8 @@ Schedule::command(GenerateManualInvoices::class)
|
|||
Schedule::command(ResetMonthlyPressReleaseQuota::class)
|
||||
->monthlyOn(1, '00:05')
|
||||
->withoutOverlapping()
|
||||
->runInBackground();
|
||||
->runInBackground()
|
||||
->onFailure($alertOnFailure('press-releases:reset-monthly-quota'));
|
||||
|
||||
// ========================================
|
||||
// Börsendaten für den Web-Ticker
|
||||
|
|
@ -74,4 +92,5 @@ Schedule::command(ResetMonthlyPressReleaseQuota::class)
|
|||
Schedule::command(RefreshMarketData::class)
|
||||
->everyFifteenMinutes()
|
||||
->withoutOverlapping()
|
||||
->runInBackground();
|
||||
->runInBackground()
|
||||
->onFailure($alertOnFailure('market:refresh'));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue