get-ccr-stats.asciidoc 8.0 KB

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