Monitor jobs and Telegram bot using Sentry
This commit is contained in:
parent
f0c3c807ac
commit
6e13e6de70
|
@ -16,9 +16,15 @@ class Kernel extends ConsoleKernel
|
|||
*/
|
||||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
$schedule->job(new UpdateAvailabilityWithSchedulesJob)->everyThirtyMinutes();
|
||||
$schedule->job(new NotifyUsersManualModeOn)->dailyAt('7:00');
|
||||
$schedule->job(new ResetAvailabilityMinutes)->monthlyOn(1, '0:00');
|
||||
$schedule->job(new UpdateAvailabilityWithSchedulesJob)
|
||||
->everyThirtyMinutes()
|
||||
->sentryMonitor();
|
||||
$schedule->job(new NotifyUsersManualModeOn)
|
||||
->dailyAt('7:00')
|
||||
->sentryMonitor();
|
||||
$schedule->job(new ResetAvailabilityMinutes)
|
||||
->monthlyOn(1, '0:00')
|
||||
->sentryMonitor();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,4 +53,11 @@ class NotifyUsersManualModeOn implements ShouldQueue
|
|||
->send();
|
||||
}
|
||||
}
|
||||
|
||||
public function failed(\Exception $exception)
|
||||
{
|
||||
if (app()->bound('sentry')) {
|
||||
app('sentry')->captureException($exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,4 +49,11 @@ class ResetAvailabilityMinutes implements ShouldQueue
|
|||
$row->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function failed(\Exception $exception)
|
||||
{
|
||||
if (app()->bound('sentry')) {
|
||||
app('sentry')->captureException($exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,4 +96,11 @@ class UpdateAvailabilityWithSchedulesJob implements ShouldQueue
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function failed(\Exception $exception)
|
||||
{
|
||||
if (app()->bound('sentry')) {
|
||||
app('sentry')->captureException($exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@ use App\Utils\Availability;
|
|||
|
||||
use DefStudio\Telegraph\Facades\Telegraph;
|
||||
|
||||
use Sentry\State\Scope;
|
||||
|
||||
class WebhookController extends
|
||||
\DefStudio\Telegraph\Handlers\WebhookHandler
|
||||
{
|
||||
|
@ -27,6 +29,16 @@ class WebhookController extends
|
|||
private function user(): User|null {
|
||||
if($this->user) return $this->user;
|
||||
$this->user = $this->message->from()->storage()->get('user');
|
||||
|
||||
if(app()->bound('sentry')) {
|
||||
\Sentry\configureScope(function (Scope $scope): void {
|
||||
$scope->setUser([
|
||||
'id' => $this->user->id,
|
||||
'name' => $this->user->name,
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,10 +53,14 @@ return [
|
|||
'channels' => [
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => ['single'],
|
||||
'channels' => ['single', 'sentry'],
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'sentry' => [
|
||||
'driver' => 'sentry',
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
|
|
Loading…
Reference in New Issue