WARNING: Version 5.1 of the Elastic Stack has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Stats API
editStats API
editThe stats
API returns the current Watcher metrics. You can control what
metrics this API returns using the metric
parameter.
The supported metrics are:
Metric | Description |
---|---|
|
Include the current executing watches in the response. |
|
Include the watches queued for execution in the response. |
|
Include all metrics in the response. |
The Watcher stats
API always returns basic metrics regardless of the
metric
option. The following example calls the stats
API including the
basic metrics:
GET _xpack/watcher/stats
A successful call returns a JSON structure similar to the following example:
{ "watcher_state": "started", "watch_count": 1, "execution_thread_pool": { "size": 1000, "max_size": 1 } }
The current state of watcher. May be either |
|
The number of watches currently registered. |
|
The number of watches that were triggered and currently queued for execution. |
|
The largest size of the execution thread pool indicating the largest number of concurrent executing watches. |
Current executing watches metric
editThe current executing watches metric gives insight into the watches that are
currently being executed by Watcher. Additional information is shared per
watch that is currently executing. This information includes the watch_id
,
the time its execution started and its current execution phase.
To include this metric, the metric
option should be set to executing_watches
or _all
.
The following example specifies the metric
option as a query string argument
and will include the basic metrics and metrics about the current executing watches:
GET _xpack/watcher/stats?metric=executing_watches
The following example specifies the metric
option as part of the url path:
GET _xpack/watcher/stats/current_watches
The following snippet shows an example of a successful JSON response that captures a watch in execution:
{ "watcher_state": "started", "watch_count": 2, "execution_thread_pool": { "queue_size": 1000, "max_size": 20 }, "current_watches": [ { "watch_id": "slow_condition", "watch_record_id": "slow_condition_3-2015-05-13T07:42:32.179Z", "triggered_time": "2015-05-12T11:53:51.800Z", "execution_time": "2015-05-13T07:42:32.179Z", "execution_phase": "condition" } ] }
A list of all the Watches that are currently being executed by Watcher. When no watches are currently executing an empty array is returned. The captured watches are sorted by execution time in descending order. Thus the longest running watch is always at the top. |
|
The id of the watch being executed. |
|
The id of the watch record. |
|
The time the watch was triggered by the trigger engine. |
|
The time the watch was executed. This is just before the input is being executed. |
|
The current watch execution phase. Can be |
In addition you can also specify the emit_stacktraces=true
parameter, which
adds stack traces for each watch that is being executed. These stacktraces can
give you more insight into an execution of a watch.
Queued watches metric
editWatcher moderates the execution of watches such that their execution won’t put too much pressure on the node and its resources. If too many watches trigger concurrently and there isn’t enough capacity to execute them all, some of the watches are queued, waiting for the current executing watches to finish their execution. The queued watches metric gives insight on these queued watches.
To include this metric, the metric
option should include queued_watches
or
_all
.
The following example specifies the queued_watches
metric option and includes
both the basic metrics and the queued watches:
GET _xpack/watcher/stats/queued_watches
An example of a successful JSON response that captures a watch in execution:
{ "watcher_state": "started", "watch_count": 10, "execution_thread_pool": { "queue_size": 1000, "max_size": 20 }, "queued_watches": [ { "watch_id": "slow_condition4", "watch_record_id": "slow_condition4_223-2015-05-21T11:59:59.811Z", "triggered_time": "2015-05-21T11:59:59.811Z", "execution_time": "2015-05-21T11:59:59.811Z" }, ... ] }