get-ccr-stats.asciidoc 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. [role="xpack"]
  2. [[ccr-get-stats]]
  3. === Get {ccr} stats API
  4. [subs="attributes"]
  5. ++++
  6. <titleabbrev>Get {ccr-init} stats</titleabbrev>
  7. ++++
  8. Get {ccr} stats.
  9. [[ccr-get-stats-request]]
  10. ==== {api-request-title}
  11. //////////////////////////
  12. [source,console]
  13. --------------------------------------------------
  14. PUT /follower_index/_ccr/follow?wait_for_active_shards=1
  15. {
  16. "remote_cluster" : "remote_cluster",
  17. "leader_index" : "leader_index"
  18. }
  19. --------------------------------------------------
  20. // TESTSETUP
  21. // TEST[setup:remote_cluster_and_leader_index]
  22. [source,console]
  23. --------------------------------------------------
  24. POST /follower_index/_ccr/pause_follow
  25. --------------------------------------------------
  26. // TEARDOWN
  27. //////////////////////////
  28. [source,console]
  29. --------------------------------------------------
  30. GET /_ccr/stats
  31. --------------------------------------------------
  32. ==== {api-prereq-title}
  33. * If the {es} {security-features} are enabled, you must have `monitor` cluster
  34. privileges on the cluster that contains the follower index. For more information,
  35. see <<security-privileges>>.
  36. [[ccr-get-stats-desc]]
  37. ==== {api-description-title}
  38. This API gets {ccr} stats. This API will return all stats related to {ccr}. In
  39. particular, this API returns stats about auto-following, and returns the same
  40. shard-level stats as in the <<ccr-get-follow-stats,get follower stats API>>.
  41. [[ccr-get-stats-query-params]]
  42. ==== {api-query-parms-title}
  43. `timeout`::
  44. (Optional, time) Controls the amount of time to wait for results. Defaults to unlimited.
  45. `master_timeout`::
  46. (Optional, <<time-units, time units>>) Specifies the period of time to wait for
  47. a connection to the master node. If no response is received before the timeout
  48. expires, the request fails and returns an error. Defaults to `30s`.
  49. [role="child_attributes"]
  50. [[ccr-get-stats-response-body]]
  51. ==== {api-response-body-title}
  52. //Begin auto_follow_stats
  53. `auto_follow_stats`::
  54. (object) An object representing stats for the auto-follow coordinator.
  55. +
  56. .Properties of `auto_follow_stats`
  57. [%collapsible%open]
  58. ====
  59. `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. `number_of_failed_remote_cluster_state_requests`::
  65. (long) The number of times that the auto-follow coordinator failed to retrieve
  66. the cluster state from a remote cluster registered in a collection of
  67. auto-follow patterns.
  68. `number_of_successful_follow_indices`::
  69. (long) The number of indices that the auto-follow coordinator successfully
  70. followed.
  71. `recent_auto_follow_errors`::
  72. (array) An array of objects representing failures by the auto-follow coordinator.
  73. ====
  74. //End auto_follow_stats
  75. `follow_stats`::
  76. (object) An object representing shard-level stats for follower indices; refer to
  77. the details of the response in the
  78. <<ccr-get-follow-stats,get follower stats API>>.
  79. [[ccr-get-stats-examples]]
  80. ==== {api-examples-title}
  81. This example retrieves {ccr} stats:
  82. [source,console]
  83. --------------------------------------------------
  84. GET /_ccr/stats
  85. --------------------------------------------------
  86. The API returns the following results:
  87. [source,console-result]
  88. --------------------------------------------------
  89. {
  90. "auto_follow_stats" : {
  91. "number_of_failed_follow_indices" : 0,
  92. "number_of_failed_remote_cluster_state_requests" : 0,
  93. "number_of_successful_follow_indices" : 1,
  94. "recent_auto_follow_errors" : [],
  95. "auto_followed_clusters" : []
  96. },
  97. "follow_stats" : {
  98. "indices" : [
  99. {
  100. "index" : "follower_index",
  101. "total_global_checkpoint_lag" : 256,
  102. "shards" : [
  103. {
  104. "remote_cluster" : "remote_cluster",
  105. "leader_index" : "leader_index",
  106. "follower_index" : "follower_index",
  107. "shard_id" : 0,
  108. "leader_global_checkpoint" : 1024,
  109. "leader_max_seq_no" : 1536,
  110. "follower_global_checkpoint" : 768,
  111. "follower_max_seq_no" : 896,
  112. "last_requested_seq_no" : 897,
  113. "outstanding_read_requests" : 8,
  114. "outstanding_write_requests" : 2,
  115. "write_buffer_operation_count" : 64,
  116. "follower_mapping_version" : 4,
  117. "follower_settings_version" : 2,
  118. "follower_aliases_version" : 8,
  119. "total_read_time_millis" : 32768,
  120. "total_read_remote_exec_time_millis" : 16384,
  121. "successful_read_requests" : 32,
  122. "failed_read_requests" : 0,
  123. "operations_read" : 896,
  124. "bytes_read" : 32768,
  125. "total_write_time_millis" : 16384,
  126. "write_buffer_size_in_bytes" : 1536,
  127. "successful_write_requests" : 16,
  128. "failed_write_requests" : 0,
  129. "operations_written" : 832,
  130. "read_exceptions" : [ ],
  131. "time_since_last_read_millis" : 8
  132. }
  133. ]
  134. }
  135. ]
  136. }
  137. }
  138. --------------------------------------------------
  139. // TESTRESPONSE[s/"total_global_checkpoint_lag" : 256/"total_global_checkpoint_lag" : 0/]
  140. // TESTRESPONSE[s/"number_of_failed_follow_indices" : 0/"number_of_failed_follow_indices" : $body.auto_follow_stats.number_of_failed_follow_indices/]
  141. // TESTRESPONSE[s/"number_of_failed_remote_cluster_state_requests" : 0/"number_of_failed_remote_cluster_state_requests" : $body.auto_follow_stats.number_of_failed_remote_cluster_state_requests/]
  142. // TESTRESPONSE[s/"number_of_successful_follow_indices" : 1/"number_of_successful_follow_indices" : $body.auto_follow_stats.number_of_successful_follow_indices/]
  143. // TESTRESPONSE[s/"recent_auto_follow_errors" : \[\]/"recent_auto_follow_errors" : $body.auto_follow_stats.recent_auto_follow_errors/]
  144. // TESTRESPONSE[s/"auto_followed_clusters" : \[\]/"auto_followed_clusters" : $body.auto_follow_stats.auto_followed_clusters/]
  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/"follower_aliases_version" : 8/"follower_aliases_version" : $body.follow_stats.indices.0.shards.0.follower_aliases_version/]
  156. // TESTRESPONSE[s/"total_read_time_millis" : 32768/"total_read_time_millis" : $body.follow_stats.indices.0.shards.0.total_read_time_millis/]
  157. // 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/]
  158. // TESTRESPONSE[s/"successful_read_requests" : 32/"successful_read_requests" : $body.follow_stats.indices.0.shards.0.successful_read_requests/]
  159. // TESTRESPONSE[s/"failed_read_requests" : 0/"failed_read_requests" : $body.follow_stats.indices.0.shards.0.failed_read_requests/]
  160. // TESTRESPONSE[s/"operations_read" : 896/"operations_read" : $body.follow_stats.indices.0.shards.0.operations_read/]
  161. // TESTRESPONSE[s/"bytes_read" : 32768/"bytes_read" : $body.follow_stats.indices.0.shards.0.bytes_read/]
  162. // TESTRESPONSE[s/"total_write_time_millis" : 16384/"total_write_time_millis" : $body.follow_stats.indices.0.shards.0.total_write_time_millis/]
  163. // 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/]
  164. // TESTRESPONSE[s/"successful_write_requests" : 16/"successful_write_requests" : $body.follow_stats.indices.0.shards.0.successful_write_requests/]
  165. // TESTRESPONSE[s/"failed_write_requests" : 0/"failed_write_requests" : $body.follow_stats.indices.0.shards.0.failed_write_requests/]
  166. // TESTRESPONSE[s/"operations_written" : 832/"operations_written" : $body.follow_stats.indices.0.shards.0.operations_written/]
  167. // 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/]