get-ccr-stats.asciidoc 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ccr-get-stats]]
  4. === Get {ccr} stats API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Get {ccr-init} stats</titleabbrev>
  8. ++++
  9. Get {ccr} stats.
  10. [[ccr-get-stats-request]]
  11. ==== {api-request-title}
  12. //////////////////////////
  13. [source,console]
  14. --------------------------------------------------
  15. PUT /follower_index/_ccr/follow?wait_for_active_shards=1
  16. {
  17. "remote_cluster" : "remote_cluster",
  18. "leader_index" : "leader_index"
  19. }
  20. --------------------------------------------------
  21. // TESTSETUP
  22. // TEST[setup:remote_cluster_and_leader_index]
  23. [source,console]
  24. --------------------------------------------------
  25. POST /follower_index/_ccr/pause_follow
  26. --------------------------------------------------
  27. // TEARDOWN
  28. //////////////////////////
  29. [source,console]
  30. --------------------------------------------------
  31. GET /_ccr/stats
  32. --------------------------------------------------
  33. ==== {api-prereq-title}
  34. * If the {es} {security-features} are enabled, you must have `monitor` cluster
  35. privileges on the cluster that contains the follower index. For more information,
  36. see <<security-privileges>>.
  37. [[ccr-get-stats-desc]]
  38. ==== {api-description-title}
  39. This API gets {ccr} stats. This API will return all stats related to {ccr}. In
  40. particular, this API returns stats about auto-following, and returns the same
  41. shard-level stats as in the <<ccr-get-follow-stats,get follower stats API>>.
  42. [[ccr-get-stats-response-body]]
  43. ==== {api-response-body-title}
  44. This API returns the following information:
  45. `auto_follow_stats`::
  46. (object) An object representing stats for the auto-follow coordinator.
  47. This object consists of the following fields:
  48. `auto_follow_stats.number_of_failed_follow_indices`::
  49. (long) The number of indices that the auto-follow coordinator failed to
  50. automatically follow. The causes of recent failures are captured in the logs
  51. of the elected master node and in the
  52. `auto_follow_stats.recent_auto_follow_errors` field.
  53. `auto_follow_stats.number_of_failed_remote_cluster_state_requests`::
  54. (long) The number of times that the auto-follow coordinator failed to retrieve
  55. the cluster state from a remote cluster registered in a collection of
  56. auto-follow patterns.
  57. `auto_follow_stats.number_of_successful_follow_indices`::
  58. (long) The number of indices that the auto-follow coordinator successfully
  59. followed.
  60. `auto_follow_stats.recent_auto_follow_errors`::
  61. (array) An array of objects representing failures by the auto-follow
  62. coordinator.
  63. `follow_stats`::
  64. (object) An object representing shard-level stats for follower indices; refer
  65. to the details of the response in the
  66. <<ccr-get-follow-stats,get follower stats API>>.
  67. [[ccr-get-stats-examples]]
  68. ==== {api-examples-title}
  69. This example retrieves {ccr} stats:
  70. [source,console]
  71. --------------------------------------------------
  72. GET /_ccr/stats
  73. --------------------------------------------------
  74. The API returns the following results:
  75. [source,console-result]
  76. --------------------------------------------------
  77. {
  78. "auto_follow_stats" : {
  79. "number_of_failed_follow_indices" : 0,
  80. "number_of_failed_remote_cluster_state_requests" : 0,
  81. "number_of_successful_follow_indices" : 1,
  82. "recent_auto_follow_errors" : [],
  83. "auto_followed_clusters" : []
  84. },
  85. "follow_stats" : {
  86. "indices" : [
  87. {
  88. "index" : "follower_index",
  89. "shards" : [
  90. {
  91. "remote_cluster" : "remote_cluster",
  92. "leader_index" : "leader_index",
  93. "follower_index" : "follower_index",
  94. "shard_id" : 0,
  95. "leader_global_checkpoint" : 1024,
  96. "leader_max_seq_no" : 1536,
  97. "follower_global_checkpoint" : 768,
  98. "follower_max_seq_no" : 896,
  99. "last_requested_seq_no" : 897,
  100. "outstanding_read_requests" : 8,
  101. "outstanding_write_requests" : 2,
  102. "write_buffer_operation_count" : 64,
  103. "follower_mapping_version" : 4,
  104. "follower_settings_version" : 2,
  105. "follower_aliases_version" : 8,
  106. "total_read_time_millis" : 32768,
  107. "total_read_remote_exec_time_millis" : 16384,
  108. "successful_read_requests" : 32,
  109. "failed_read_requests" : 0,
  110. "operations_read" : 896,
  111. "bytes_read" : 32768,
  112. "total_write_time_millis" : 16384,
  113. "write_buffer_size_in_bytes" : 1536,
  114. "successful_write_requests" : 16,
  115. "failed_write_requests" : 0,
  116. "operations_written" : 832,
  117. "read_exceptions" : [ ],
  118. "time_since_last_read_millis" : 8
  119. }
  120. ]
  121. }
  122. ]
  123. }
  124. }
  125. --------------------------------------------------
  126. // TESTRESPONSE[s/"number_of_failed_follow_indices" : 0/"number_of_failed_follow_indices" : $body.auto_follow_stats.number_of_failed_follow_indices/]
  127. // 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/]
  128. // TESTRESPONSE[s/"number_of_successful_follow_indices" : 1/"number_of_successful_follow_indices" : $body.auto_follow_stats.number_of_successful_follow_indices/]
  129. // TESTRESPONSE[s/"recent_auto_follow_errors" : \[\]/"recent_auto_follow_errors" : $body.auto_follow_stats.recent_auto_follow_errors/]
  130. // TESTRESPONSE[s/"auto_followed_clusters" : \[\]/"auto_followed_clusters" : $body.auto_follow_stats.auto_followed_clusters/]
  131. // TESTRESPONSE[s/"leader_global_checkpoint" : 1024/"leader_global_checkpoint" : $body.follow_stats.indices.0.shards.0.leader_global_checkpoint/]
  132. // TESTRESPONSE[s/"leader_max_seq_no" : 1536/"leader_max_seq_no" : $body.follow_stats.indices.0.shards.0.leader_max_seq_no/]
  133. // TESTRESPONSE[s/"follower_global_checkpoint" : 768/"follower_global_checkpoint" : $body.follow_stats.indices.0.shards.0.follower_global_checkpoint/]
  134. // TESTRESPONSE[s/"follower_max_seq_no" : 896/"follower_max_seq_no" : $body.follow_stats.indices.0.shards.0.follower_max_seq_no/]
  135. // TESTRESPONSE[s/"last_requested_seq_no" : 897/"last_requested_seq_no" : $body.follow_stats.indices.0.shards.0.last_requested_seq_no/]
  136. // TESTRESPONSE[s/"outstanding_read_requests" : 8/"outstanding_read_requests" : $body.follow_stats.indices.0.shards.0.outstanding_read_requests/]
  137. // TESTRESPONSE[s/"outstanding_write_requests" : 2/"outstanding_write_requests" : $body.follow_stats.indices.0.shards.0.outstanding_write_requests/]
  138. // TESTRESPONSE[s/"write_buffer_operation_count" : 64/"write_buffer_operation_count" : $body.follow_stats.indices.0.shards.0.write_buffer_operation_count/]
  139. // TESTRESPONSE[s/"follower_mapping_version" : 4/"follower_mapping_version" : $body.follow_stats.indices.0.shards.0.follower_mapping_version/]
  140. // TESTRESPONSE[s/"follower_settings_version" : 2/"follower_settings_version" : $body.follow_stats.indices.0.shards.0.follower_settings_version/]
  141. // TESTRESPONSE[s/"follower_aliases_version" : 8/"follower_aliases_version" : $body.follow_stats.indices.0.shards.0.follower_aliases_version/]
  142. // TESTRESPONSE[s/"total_read_time_millis" : 32768/"total_read_time_millis" : $body.follow_stats.indices.0.shards.0.total_read_time_millis/]
  143. // 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/]
  144. // TESTRESPONSE[s/"successful_read_requests" : 32/"successful_read_requests" : $body.follow_stats.indices.0.shards.0.successful_read_requests/]
  145. // TESTRESPONSE[s/"failed_read_requests" : 0/"failed_read_requests" : $body.follow_stats.indices.0.shards.0.failed_read_requests/]
  146. // TESTRESPONSE[s/"operations_read" : 896/"operations_read" : $body.follow_stats.indices.0.shards.0.operations_read/]
  147. // TESTRESPONSE[s/"bytes_read" : 32768/"bytes_read" : $body.follow_stats.indices.0.shards.0.bytes_read/]
  148. // TESTRESPONSE[s/"total_write_time_millis" : 16384/"total_write_time_millis" : $body.follow_stats.indices.0.shards.0.total_write_time_millis/]
  149. // 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/]
  150. // TESTRESPONSE[s/"successful_write_requests" : 16/"successful_write_requests" : $body.follow_stats.indices.0.shards.0.successful_write_requests/]
  151. // TESTRESPONSE[s/"failed_write_requests" : 0/"failed_write_requests" : $body.follow_stats.indices.0.shards.0.failed_write_requests/]
  152. // TESTRESPONSE[s/"operations_written" : 832/"operations_written" : $body.follow_stats.indices.0.shards.0.operations_written/]
  153. // 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/]
  154. // TESTRESPONSE[skip:"AwaitsFix https://github.com/elastic/elasticsearch/issues/47718"]