-
Notifications
You must be signed in to change notification settings - Fork 162
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
Task Scheduling monitoring? #89
Comments
Thanks for the suggestion. What sort of metrics would you be thinking? I guess slow scheduled tasks? Not sure if/when we'll get to this, but in the meantime it's possible to create a custom card and recorder for this. I'll be updating the docs with more instructions next week. |
Hi @jessarcher! I would love this feature too! I have created a Pulse card to monitor the size of the tables in a database, but I don't need to do it on every global check, doing it once every hour would be enough: https://github.com/eusonlito/LaravelPulseDatabaseTablesSize How do you think I should deal with this? Maybe applying check logic on the last stored record and compare the timestamp with the current time? Thanks! |
Currently I'm using this control: /**
* @param \Laravel\Pulse\Events\SharedBeat $event
*
* @return void
*/
public function record(SharedBeat $event): void
{
if ($this->enabled()) {
$this->set();
}
}
/**
* @return bool
*/
protected function enabled(): bool
{
return $this->enabledConfig()
&& $this->enabledSchedule();
}
/**
* @return bool
*/
protected function enabledConfig(): bool
{
return $this->config('enabled');
}
/**
* @return bool
*/
protected function enabledSchedule(): bool
{
$timestamp = $this->pulse->values('database-tables-size', ['result'])->value('timestamp');
if (empty($timestamp)) {
return true;
}
$time = match ($this->config('schedule')) {
'halfhour' => strtotime('-30 minutes'),
'hour' => strtotime('-1 hour'),
'quarterday' => strtotime('-4 hours'),
'halfday' => strtotime('-12 hours'),
'day' => strtotime('-1 day'),
default => 0,
};
return $timestamp <= $time;
} |
This would be a super awesome feature.
The text was updated successfully, but these errors were encountered: