What is the use case for using "taskSchedule" for extensions? How do I configure "taskSchedule"?
Why use "taskSchedule" to monitor intervals?
The execution frequency for an extension is typically set using the element <execution-frequency-in-seconds> in the
monitor.xml. However, this value cannot be higher than 300 seconds. For use cases where an artifact needs to be monitored with an interval greater than 300 seconds, taskSchedule should be used.
The SDK provides a mechanism to cache the metrics and retain them for a maximum period of 15 minutes. When taskSchedule is configured, the Machine Agent still runs the extension as configured in <execution-frequency-in-seconds>. However, the extension returns cached values until the cache refreshes, as specified in the taskDelaySeconds field of the configuration.
How do I configure config.yml to use task schedule mode?
In order to use task schedule mode, the following line should be included in the
- numberOfThreads is the size of the core thread pool that is used by the Scheduled Threadpool Executor. The default is 1.
- taskDelaySeconds is the scheduling interval in seconds.
Here is an example to schedule tasks for every 12 minutes (12 * 60 seconds)
Details to know about using "taskSchedule"
- The ideal scenario for using taskSchedule is when you want to fetch current metrics at an interval of more than 300 seconds (5 minutes).
- The cached metrics are only retained for 15 minutes, after which they expire and are re-cached in the next scheduled run.
- If taskDelaySeconds is configured to be more than 15 minutes, the extension will report null values which will lead to gaps on the Metric Browser.