Conversation
c80cd73 to
d6970da
Compare
d6970da to
ef78e91
Compare
cleptric
approved these changes
Jun 27, 2023
Member
cleptric
left a comment
There was a problem hiding this comment.
![]()
Will get the docs ready then.
3 tasks
Contributor
|
This is how i was able to monitor app of my schedule tasks <?php
namespace App\Providers;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Support\ServiceProvider;
class CronMonitorProvider extends ServiceProvider
{
public function boot(): void
{
if (!$this->app->runningInConsole()) {
return;
}
$this->app->booted(fn() => $this->hookMonitor());
}
protected function hookMonitor(): void
{
$events = $this->app->make(Schedule::class)->events();
foreach ($events as $event) {
if ($event->hasMacro('sentryMonitor')) {
$event->sentryMonitor();
}
}
}
} |
Collaborator
Author
|
@ankurk91 ah, that is a smart one to hook all your scheduled events at once, nice! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Making use of the new cron monitoring upsert possibilities we can add some information to automatically create a cron monitor by "simply" scheduling an command and calling
->sentryMonitor()on it.The
sentryMonitormethod has a few (all optional) arguments:Would be nice to have:
This depends on the release of: