Stats API

Request

GET _xpack/watcher/stats

GET _xpack/watcher/stats/<metric>

Description

This API always returns basic metrics. You retrieve more metrics by using
the metric parameter.

Current executing watches metric

The 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. In addition you can also specify the emit_stacktraces=true
parameter, which adds stack traces for each watch that is being executed. These
stack traces can give you more insight into an execution of a watch.

Queued watches metric

Watcher 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.

Path Parameters

emit_stacktraces

(boolean) Defines whether stack traces are generated for each watch that is
running. The default value is false.

metric

(enum) Defines which additional metrics are included in the response.

executing_watches

Includes the current executing watches in the response.

queued_watches

Includes the watches queued for execution in the response.

_all

Includes all metrics in the response.

Authorization

You must have manage_watcher or monitor_watcher cluster privileges to use
this API. For more information, see
Security Privileges.

Examples

The following example calls the stats API to retrieve basic metrics:

GET _xpack/watcher/stats

A successful call returns a JSON structure similar to the following example:

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.