mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-04-24 23:27:25 -04:00
**Problem:** For historical reasons, source files for the Elasticsearch Guide's security, watcher, and Logstash API docs are housed in the `x-pack/docs` directory. This can confuse new contributors who expect Elasticsearch Guide docs to be located in `docs/reference`. **Solution:** - Move the security, watcher, and Logstash API doc source files to the `docs/reference` directory - Update doc snippet tests to use security Rel: https://github.com/elastic/platform-docs-team/issues/208
32 lines
1.2 KiB
Text
32 lines
1.2 KiB
Text
[discrete]
|
|
[[api-java-stats]]
|
|
=== {watcher} stats API
|
|
|
|
The `stats` API returns the current {watcher} metrics. You can control what
|
|
metrics this API returns using the `metric` parameter.
|
|
|
|
The following example queries the `stats` API :
|
|
|
|
[source,java]
|
|
--------------------------------------------------
|
|
WatcherStatsResponse watcherStatsResponse = watcherClient.prepareWatcherStats().get();
|
|
--------------------------------------------------
|
|
|
|
A successful call returns a response structure that can be accessed as shown:
|
|
|
|
[source,java]
|
|
--------------------------------------------------
|
|
WatcherBuild build = watcherStatsResponse.getBuild();
|
|
|
|
// The current size of the watcher execution queue
|
|
long executionQueueSize = watcherStatsResponse.getThreadPoolQueueSize();
|
|
|
|
// The maximum size the watch execution queue has grown to
|
|
long executionQueueMaxSize = watcherStatsResponse.getThreadPoolQueueSize();
|
|
|
|
// The total number of watches registered in the system
|
|
long totalNumberOfWatches = watcherStatsResponse.getWatchesCount();
|
|
|
|
// {watcher} state (STARTING,STOPPED or STARTED)
|
|
WatcherState watcherState = watcherStatsResponse.getWatcherState();
|
|
--------------------------------------------------
|