@@ -12,12 +12,155 @@ Get {ccr} stats.
1212
1313==== Description
1414
15- This API gets {ccr} stats.
15+ This API gets {ccr} stats. This API will return all stats related to {ccr}. In
16+ particular, this API returns stats about auto-following, and returns the same
17+ shard-level stats as in the <<ccr-get-follow-stats,get follower stats API>>.
1618
1719==== Request
1820
21+ //////////////////////////
22+
23+ [source,js]
24+ --------------------------------------------------
25+ PUT /follower_index/_ccr/follow
26+ {
27+ "remote_cluster" : "remote_cluster",
28+ "leader_index" : "leader_index"
29+ }
30+ --------------------------------------------------
31+ // CONSOLE
32+ // TESTSETUP
33+ // TEST[setup:remote_cluster_and_leader_index]
34+
35+ [source,js]
36+ --------------------------------------------------
37+ POST /follower_index/_ccr/pause_follow
38+ --------------------------------------------------
39+ // CONSOLE
40+ // TEARDOWN
41+
42+ //////////////////////////
43+
44+ [source,js]
45+ --------------------------------------------------
46+ GET /_ccr/stats
47+ --------------------------------------------------
48+ // CONSOLE
49+
50+ ==== Results
51+
52+ This API returns the following information:
53+
54+ `auto_follow_stats`::
55+ (object) an object representing stats for the auto-follow coordinator
56+
57+ This object consists of the following fields:
58+
59+ `auto_follow_stats.number_of_failed_follow_indices`::
60+ (long) the number of indices that the auto-follow coordinator failed to
61+ automatically follow; the causes of recent failures are captured in the logs
62+ of the elected master node, and in the
63+ `auto_follow_stats.recent_auto_follow_errors` field
64+
65+ `auto_follow_stats.number_of_failed_remote_cluster_state_requests`::
66+ (long) the number of times that the auto-follow coordinator failed to retrieve
67+ the cluster state from a remote cluster registered in a collection of
68+ auto-follow patterns
69+
70+ `auto_follow_stats.number_of_successful_follow_indices`::
71+ (long) the number of indices that the auto-follow coordinator successfully
72+ followed
73+
74+ `auto_follow_stats.recent_auto_follow_errors`::
75+ (array) an array of objects representing failures by the auto-follow
76+ coordinator
77+
78+ `follow_stats`::
79+ (object) an object representing shard-level stats for follower indices; refer
80+ to the details of the response in the
81+ <<ccr-get-follow-stats,get follower stats API>>
82+
83+ ==== Example
84+
85+ This example retrieves {ccr} stats:
86+
1987[source,js]
2088--------------------------------------------------
2189GET /_ccr/stats
2290--------------------------------------------------
2391// CONSOLE
92+
93+ The API returns the following results:
94+
95+ [source,js]
96+ --------------------------------------------------
97+ {
98+ "auto_follow_stats" : {
99+ "number_of_failed_follow_indices" : 0,
100+ "number_of_failed_remote_cluster_state_requests" : 0,
101+ "number_of_successful_follow_indices" : 1,
102+ "recent_auto_follow_errors" : [ ]
103+ },
104+ "follow_stats" : {
105+ "indices" : [
106+ {
107+ "index" : "follower_index",
108+ "shards" : [
109+ {
110+ "remote_cluster" : "remote_cluster",
111+ "leader_index" : "leader_index",
112+ "follower_index" : "follower_index",
113+ "shard_id" : 0,
114+ "leader_global_checkpoint" : 1024,
115+ "leader_max_seq_no" : 1536,
116+ "follower_global_checkpoint" : 768,
117+ "follower_max_seq_no" : 896,
118+ "last_requested_seq_no" : 897,
119+ "outstanding_read_requests" : 8,
120+ "outstanding_write_requests" : 2,
121+ "write_buffer_operation_count" : 64,
122+ "follower_mapping_version" : 4,
123+ "follower_settings_version" : 2,
124+ "total_read_time_millis" : 32768,
125+ "total_read_remote_exec_time_millis" : 16384,
126+ "successful_read_requests" : 32,
127+ "failed_read_requests" : 0,
128+ "operations_read" : 896,
129+ "bytes_read" : 32768,
130+ "total_write_time_millis" : 16384,
131+ "write_buffer_size_in_bytes" : 1536,
132+ "successful_write_requests" : 16,
133+ "failed_write_requests" : 0,
134+ "operations_written" : 832,
135+ "read_exceptions" : [ ],
136+ "time_since_last_read_millis" : 8
137+ }
138+ ]
139+ }
140+ ]
141+ }
142+ }
143+ --------------------------------------------------
144+ // TESTRESPONSE[s/"number_of_successful_follow_indices" : 1/"number_of_successful_follow_indices" : $body.auto_follow_stats.number_of_successful_follow_indices/]
145+ // TESTRESPONSE[s/"leader_global_checkpoint" : 1024/"leader_global_checkpoint" : $body.follow_stats.indices.0.shards.0.leader_global_checkpoint/]
146+ // TESTRESPONSE[s/"leader_max_seq_no" : 1536/"leader_max_seq_no" : $body.follow_stats.indices.0.shards.0.leader_max_seq_no/]
147+ // TESTRESPONSE[s/"follower_global_checkpoint" : 768/"follower_global_checkpoint" : $body.follow_stats.indices.0.shards.0.follower_global_checkpoint/]
148+ // TESTRESPONSE[s/"follower_max_seq_no" : 896/"follower_max_seq_no" : $body.follow_stats.indices.0.shards.0.follower_max_seq_no/]
149+ // TESTRESPONSE[s/"last_requested_seq_no" : 897/"last_requested_seq_no" : $body.follow_stats.indices.0.shards.0.last_requested_seq_no/]
150+ // TESTRESPONSE[s/"outstanding_read_requests" : 8/"outstanding_read_requests" : $body.follow_stats.indices.0.shards.0.outstanding_read_requests/]
151+ // TESTRESPONSE[s/"outstanding_write_requests" : 2/"outstanding_write_requests" : $body.follow_stats.indices.0.shards.0.outstanding_write_requests/]
152+ // TESTRESPONSE[s/"write_buffer_operation_count" : 64/"write_buffer_operation_count" : $body.follow_stats.indices.0.shards.0.write_buffer_operation_count/]
153+ // TESTRESPONSE[s/"follower_mapping_version" : 4/"follower_mapping_version" : $body.follow_stats.indices.0.shards.0.follower_mapping_version/]
154+ // TESTRESPONSE[s/"follower_settings_version" : 2/"follower_settings_version" : $body.follow_stats.indices.0.shards.0.follower_settings_version/]
155+ // TESTRESPONSE[s/"total_read_time_millis" : 32768/"total_read_time_millis" : $body.follow_stats.indices.0.shards.0.total_read_time_millis/]
156+ // TESTRESPONSE[s/"total_read_remote_exec_time_millis" : 16384/"total_read_remote_exec_time_millis" : $body.follow_stats.indices.0.shards.0.total_read_remote_exec_time_millis/]
157+ // TESTRESPONSE[s/"successful_read_requests" : 32/"successful_read_requests" : $body.follow_stats.indices.0.shards.0.successful_read_requests/]
158+ // TESTRESPONSE[s/"failed_read_requests" : 0/"failed_read_requests" : $body.follow_stats.indices.0.shards.0.failed_read_requests/]
159+ // TESTRESPONSE[s/"operations_read" : 896/"operations_read" : $body.follow_stats.indices.0.shards.0.operations_read/]
160+ // TESTRESPONSE[s/"bytes_read" : 32768/"bytes_read" : $body.follow_stats.indices.0.shards.0.bytes_read/]
161+ // TESTRESPONSE[s/"total_write_time_millis" : 16384/"total_write_time_millis" : $body.follow_stats.indices.0.shards.0.total_write_time_millis/]
162+ // TESTRESPONSE[s/"write_buffer_size_in_bytes" : 1536/"write_buffer_size_in_bytes" : $body.follow_stats.indices.0.shards.0.write_buffer_size_in_bytes/]
163+ // TESTRESPONSE[s/"successful_write_requests" : 16/"successful_write_requests" : $body.follow_stats.indices.0.shards.0.successful_write_requests/]
164+ // TESTRESPONSE[s/"failed_write_requests" : 0/"failed_write_requests" : $body.follow_stats.indices.0.shards.0.failed_write_requests/]
165+ // TESTRESPONSE[s/"operations_written" : 832/"operations_written" : $body.follow_stats.indices.0.shards.0.operations_written/]
166+ // TESTRESPONSE[s/"time_since_last_read_millis" : 8/"time_since_last_read_millis" : $body.follow_stats.indices.0.shards.0.time_since_last_read_millis/]
0 commit comments