get-datafeed-stats.asciidoc 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-get-datafeed-stats]]
  4. === Get {dfeed} statistics API
  5. [subs="attributes"]
  6. ++++
  7. <titleabbrev>Get {dfeed} statistics</titleabbrev>
  8. ++++
  9. Retrieves usage information for {dfeeds}.
  10. [[ml-get-datafeed-stats-request]]
  11. ==== {api-request-title}
  12. `GET _ml/datafeeds/<feed_id>/_stats` +
  13. `GET _ml/datafeeds/<feed_id>,<feed_id>/_stats` +
  14. `GET _ml/datafeeds/_stats` +
  15. `GET _ml/datafeeds/_all/_stats` +
  16. [[ml-get-datafeed-stats-desc]]
  17. ==== {api-description-title}
  18. You can get statistics for multiple {dfeeds} in a single API request by using a
  19. comma-separated list of {dfeeds} or a wildcard expression. You can get
  20. statistics for all {dfeeds} by using `_all`, by specifying `*` as the
  21. `<feed_id>`, or by omitting the `<feed_id>`.
  22. If the {dfeed} is stopped, the only information you receive is the
  23. `datafeed_id` and the `state`.
  24. IMPORTANT: This API returns a maximum of 10,000 {dfeeds}.
  25. [[ml-get-datafeed-stats-path-parms]]
  26. ==== {api-path-parms-title}
  27. `feed_id`::
  28. (string) Identifier for the {dfeed}. It can be a {dfeed} identifier or a
  29. wildcard expression. If you do not specify one of these options, the API
  30. returns statistics for all {dfeeds}.
  31. [[ml-get-datafeed-stats-results]]
  32. ==== {api-response-body-title}
  33. The API returns the following information:
  34. `datafeeds`::
  35. (array) An array of {dfeed} count objects.
  36. For more information, see <<ml-datafeed-counts>>.
  37. [[ml-get-datafeed-stats-prereqs]]
  38. ==== {api-prereq-title}
  39. You must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster
  40. privileges to use this API. For more information, see
  41. {stack-ov}/security-privileges.html[Security Privileges].
  42. [[ml-get-datafeed-stats-example]]
  43. ==== {api-examples-title}
  44. The following example gets usage information for the
  45. `datafeed-total-requests` {dfeed}:
  46. [source,js]
  47. --------------------------------------------------
  48. GET _ml/datafeeds/datafeed-total-requests/_stats
  49. --------------------------------------------------
  50. // CONSOLE
  51. // TEST[skip:setup:server_metrics_startdf]
  52. The API returns the following results:
  53. [source,js]
  54. ----
  55. {
  56. "count": 1,
  57. "datafeeds": [
  58. {
  59. "datafeed_id": "datafeed-total-requests",
  60. "state": "started",
  61. "node": {
  62. "id": "2spCyo1pRi2Ajo-j-_dnPX",
  63. "name": "node-0",
  64. "ephemeral_id": "hoXMLZB0RWKfR9UPPUCxXX",
  65. "transport_address": "127.0.0.1:9300",
  66. "attributes": {
  67. "ml.machine_memory": "17179869184",
  68. "ml.max_open_jobs": "20"
  69. }
  70. },
  71. "assignment_explanation": ""
  72. }
  73. ]
  74. }
  75. ----
  76. // TESTRESPONSE[s/"2spCyo1pRi2Ajo-j-_dnPX"/$body.$_path/]
  77. // TESTRESPONSE[s/"node-0"/$body.$_path/]
  78. // TESTRESPONSE[s/"hoXMLZB0RWKfR9UPPUCxXX"/$body.$_path/]
  79. // TESTRESPONSE[s/"127.0.0.1:9300"/$body.$_path/]
  80. // TESTRESPONSE[s/"17179869184"/$body.datafeeds.0.node.attributes.ml\\.machine_memory/]