34 lines
1.2 KiB
Plaintext
34 lines
1.2 KiB
Plaintext
[[api-java-stats]]
|
|
==== Stats API
|
|
|
|
The Watcher `stats` API returns information on the aspects of Watcher on your cluster.
|
|
|
|
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 Version of watcher currently running
|
|
WatcherVersion version = watcherStatsResponse.getVersion();
|
|
|
|
// The current size of the watcher execution queue
|
|
long executionQueueSize = watcherStatsResponse.getExecutionQueueSize();
|
|
|
|
// The maximum size the watch execution queue has grown to
|
|
long executionQueueMaxSize = watcherStatsResponse.getWatchExecutionQueueMaxSize();
|
|
|
|
// The total number of watches registered in the system
|
|
long totalNumberOfWatches = watcherStatsResponse.getWatchesCount();
|
|
|
|
// Watcher state (STARTING,STOPPED or STARTED)
|
|
WatcherState watcherState = watcherStatsResponse.getWatcherState();
|
|
--------------------------------------------------
|