On this page
Monitor Task
This documentation needs work. See "Help improve this page" in the sidebar.
Once a Monitor has been defined, we can start to define monitor tasks. Ideally these would be the code portion of the config entity and would reference the machine name of the config entity to allow grouping and enabling/disabling all of a monitor’s tasks as a group.
The tasks are performed during cron jobs to determine the status of a monitor. They should be short, simple tasks that can easily be performed during a cron job session without causing timeouts or heavy load on the server. Ideas for this include:
- Checking a connection between Drupal and an endpoint can be established.
- Checking that an automated process completed successfully.
- Checking the status of the queue table (size, date + source of oldest entry, etc).
- Check that latest video was posted to homepage as expected.
- …and more
To aid developers in creating their Monitor Tasks, a base class should be created that contains instantiations of default methods. Ideas for these methods include:
- Getters for the task’s Monitor config entity detail.
- Abstract class: runTask that will be run to determine the status of the task.
These tasks should include detail in their annotations that include the following values:
|
Machine name |
Description |
|---|---|
|
monitor_task_name |
Machine name for this task. |
|
monitor_type |
Machine name of associated Monitor. |
|
monitor_task_group |
A machine name of a cron group to use for this task. Allows devs to split tasks across cron jobs giving the flexibility to run them when they want. |
|
retry_threshold |
The amount of time to wait before retrying a failed task. This helps grants control over the frequency that an endpoint of a task is queried given it is in an error state. Warning states will be processed as usual. |
Monitor Tasks will be the source of triggering Monitor Events. These events should be one of following:
- OK - Default state for tasks that have run without triggering warnings/errors.
- WARNING - A state that indicates something went wrong, but not badly enough to require immediate attention.
- ERROR - The task failed to complete in such as way that indicates the site will experience an interruption in service.
- PENDING - Default state for all new tasks that have yet to run.
- RESOLVED - State for incidents that have been resolved. Can be manually set through the UI if needed.
To be added:
- Details on how to define a Monitor task.
- Ideas on use of tasks
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion