OpenSearch/docs/reference/ml/anomaly-detection/apis/get-job-stats.asciidoc

477 lines
13 KiB
Plaintext
Raw Normal View History

[role="xpack"]
[testenv="platinum"]
[[ml-get-job-stats]]
= Get {anomaly-job} statistics API
++++
2018-12-20 13:23:28 -05:00
<titleabbrev>Get job statistics</titleabbrev>
++++
Retrieves usage information for {anomaly-jobs}.
[[ml-get-job-stats-request]]
== {api-request-title}
`GET _ml/anomaly_detectors/<job_id>/_stats`
`GET _ml/anomaly_detectors/<job_id>,<job_id>/_stats` +
`GET _ml/anomaly_detectors/_stats` +
`GET _ml/anomaly_detectors/_all/_stats`
[[ml-get-job-stats-prereqs]]
== {api-prereq-title}
* If the {es} {security-features} are enabled, you must have `monitor_ml`,
`monitor`, `manage_ml`, or `manage` cluster privileges to use this API. See
<<security-privileges>>.
[[ml-get-job-stats-desc]]
== {api-description-title}
You can get statistics for multiple {anomaly-jobs} in a single API request by
using a group name, a comma-separated list of jobs, or a wildcard expression.
You can get statistics for all {anomaly-jobs} by using `_all`, by specifying `*`
as the `<job_id>`, or by omitting the `<job_id>`.
IMPORTANT: This API returns a maximum of 10,000 jobs.
[[ml-get-job-stats-path-parms]]
== {api-path-parms-title}
`<job_id>`::
(Optional, string)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection-default]
[[ml-get-job-stats-query-parms]]
== {api-query-parms-title}
`allow_no_jobs`::
(Optional, boolean)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=allow-no-jobs]
[role="child_attributes"]
[[ml-get-job-stats-results]]
== {api-response-body-title}
The API returns the following information about the operational progress of a
job:
`assignment_explanation`::
(string)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=assignment-explanation-anomaly-jobs]
//Begin data_counts
[[datacounts]]`data_counts`::
(object) An object that describes the quantity of input to the job and any
related error counts. The `data_count` values are cumulative for the lifetime of
a job. If a model snapshot is reverted or old results are deleted, the job
counts are not reset.
+
.Properties of `data_counts`
[%collapsible%open]
====
`bucket_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-count-anomaly-jobs]
`earliest_record_timestamp`:::
(date)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=earliest-record-timestamp]
`empty_bucket_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=empty-bucket-count]
`input_bytes`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=input-bytes]
`input_field_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=input-field-count]
`input_record_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=input-record-count]
`invalid_date_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=invalid-date-count]
`job_id`:::
(string)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
`last_data_time`:::
(date)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=last-data-time]
`latest_empty_bucket_timestamp`:::
(date)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=latest-empty-bucket-timestamp]
`latest_record_timestamp`:::
(date)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=latest-record-timestamp]
`latest_sparse_bucket_timestamp`:::
(date)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=latest-sparse-record-timestamp]
`missing_field_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=missing-field-count]
+
The value of `processed_record_count` includes this count.
`out_of_order_timestamp_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=out-of-order-timestamp-count]
`processed_field_count`:::
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=processed-field-count]
`processed_record_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=processed-record-count]
`sparse_bucket_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=sparse-bucket-count]
====
//End data_counts
`deleting`::
(boolean)
Indicates that the process of deleting the job is in progress but not yet
completed. It is only reported when `true`.
//Begin forecasts_stats
[[forecastsstats]]`forecasts_stats`::
(object) An object that provides statistical information about forecasts
belonging to this job. Some statistics are omitted if no forecasts have been
made.
+
NOTE: Unless there is at least one forecast, `memory_bytes`, `records`,
`processing_time_ms` and `status` properties are omitted.
+
.Properties of `forecasts_stats`
[%collapsible%open]
====
`forecasted_jobs`:::
(long) A value of `0` indicates that forecasts do not exist for this job. A
value of `1` indicates that at least one forecast exists.
`memory_bytes`:::
(object) The `avg`, `min`, `max` and `total` memory usage in bytes for forecasts
related to this job. If there are no forecasts, this property is omitted.
`processing_time_ms`:::
(object) The `avg`, `min`, `max` and `total` runtime in milliseconds for
forecasts related to this job. If there are no forecasts, this property is
omitted.
`records`:::
(object) The `avg`, `min`, `max` and `total` number of `model_forecast` documents
written for forecasts related to this job. If there are no forecasts, this
property is omitted.
`status`:::
(object) The count of forecasts by their status. For example:
{"finished" : 2, "started" : 1}. If there are no forecasts, this property is
omitted.
`total`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=forecast-total]
====
//End forecasts_stats
`job_id`::
(string)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
//Begin model_size_stats
[[modelsizestats]]`model_size_stats`::
(object) An object that provides information about the size and contents of the
model.
+
.Properties of `model_size_stats`
[%collapsible%open]
====
`bucket_allocation_failures_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-allocation-failures-count]
`categorized_doc_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=categorized-doc-count]
`categorization_status`:::
(string)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=categorization-status]
`dead_category_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=dead-category-count]
`failed_category_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=failed-category-count]
`frequent_category_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=frequent-category-count]
`job_id`:::
(string)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
`log_time`:::
(date) The timestamp of the `model_size_stats` according to server time.
`memory_status`:::
(string)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-memory-status]
`model_bytes`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-bytes]
`model_bytes_exceeded`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-bytes-exceeded]
`model_bytes_memory_limit`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-memory-limit-anomaly-jobs]
`peak_model_bytes`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=peak-model-bytes]
`rare_category_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=rare-category-count]
`result_type`:::
(string) For internal use. The type of result.
`total_by_field_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=total-by-field-count]
`total_category_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=total-category-count]
`total_over_field_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=total-over-field-count]
`total_partition_field_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=total-partition-field-count]
`timestamp`:::
(date)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=model-timestamp]
====
//End model_size_stats
//Begin node
[[stats-node]]`node`::
(object) Contains properties for the node that runs the job. This information is
available only for open jobs.
+
.Properties of `node`
[%collapsible%open]
====
`attributes`:::
(object)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=node-attributes]
`ephemeral_id`:::
(string)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=node-ephemeral-id]
`id`:::
(string)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=node-id]
`name`:::
(string)
The node name.
`transport_address`:::
(string)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=node-transport-address]
====
//End node
`open_time`::
(string)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=open-time]
`state`::
(string)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=state-anomaly-job]
//Begin timing_stats
[[timingstats]]`timing_stats`::
(object) An object that provides statistical information about timing aspect of
this job.
+
.Properties of `timing_stats`
[%collapsible%open]
====
`average_bucket_processing_time_ms`:::
(double) Average of all bucket processing times in milliseconds.
`bucket_count`:::
(long)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-count]
`exponential_average_bucket_processing_time_ms`:::
(double)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-time-exponential-average]
`exponential_average_bucket_processing_time_per_hour_ms`:::
(double)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-time-exponential-average-hour]
`job_id`:::
(string)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=job-id-anomaly-detection]
`maximum_bucket_processing_time_ms`:::
(double)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-time-maximum]
`minimum_bucket_processing_time_ms`:::
(double)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-time-minimum]
`total_bucket_processing_time_ms`:::
(double)
include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=bucket-time-total]
====
//End timing_stats
[[ml-get-job-stats-response-codes]]
== {api-response-codes-title}
`404` (Missing resources)::
If `allow_no_jobs` is `false`, this code indicates that there are no
resources that match the request or only partial matches for the request.
[[ml-get-job-stats-example]]
== {api-examples-title}
[source,console]
--------------------------------------------------
GET _ml/anomaly_detectors/low_request_rate/_stats
--------------------------------------------------
// TEST[skip:Kibana sample data]
The API returns the following results:
[source,js]
----
{
"count" : 1,
"jobs" : [
{
"job_id" : "low_request_rate",
"data_counts" : {
"job_id" : "low_request_rate",
"processed_record_count" : 1216,
"processed_field_count" : 1216,
"input_bytes" : 51678,
"input_field_count" : 1216,
"invalid_date_count" : 0,
"missing_field_count" : 0,
"out_of_order_timestamp_count" : 0,
"empty_bucket_count" : 242,
"sparse_bucket_count" : 0,
"bucket_count" : 1457,
"earliest_record_timestamp" : 1575172659612,
"latest_record_timestamp" : 1580417369440,
"last_data_time" : 1576017595046,
"latest_empty_bucket_timestamp" : 1580356800000,
"input_record_count" : 1216
},
"model_size_stats" : {
"job_id" : "low_request_rate",
"result_type" : "model_size_stats",
"model_bytes" : 41480,
"model_bytes_exceeded" : 0,
"model_bytes_memory_limit" : 10485760,
"total_by_field_count" : 3,
"total_over_field_count" : 0,
"total_partition_field_count" : 2,
"bucket_allocation_failures_count" : 0,
"memory_status" : "ok",
"categorized_doc_count" : 0,
"total_category_count" : 0,
"frequent_category_count" : 0,
"rare_category_count" : 0,
"dead_category_count" : 0,
"failed_category_count" : 0,
"categorization_status" : "ok",
"log_time" : 1576017596000,
"timestamp" : 1580410800000
},
"forecasts_stats" : {
"total" : 1,
"forecasted_jobs" : 1,
"memory_bytes" : {
"total" : 9179.0,
"min" : 9179.0,
"avg" : 9179.0,
"max" : 9179.0
},
"records" : {
"total" : 168.0,
"min" : 168.0,
"avg" : 168.0,
"max" : 168.0
},
"processing_time_ms" : {
"total" : 40.0,
"min" : 40.0,
"avg" : 40.0,
"max" : 40.0
},
"status" : {
"finished" : 1
}
},
"state" : "opened",
"node" : {
"id" : "7bmMXyWCRs-TuPfGJJ_yMw",
"name" : "node-0",
"ephemeral_id" : "hoXMLZB0RWKfR9UPPUCxXX",
"transport_address" : "127.0.0.1:9300",
"attributes" : {
"ml.machine_memory" : "17179869184",
"xpack.installed" : "true",
"ml.max_open_jobs" : "20"
}
},
"assignment_explanation" : "",
"open_time" : "13s",
"timing_stats" : {
"job_id" : "low_request_rate",
"bucket_count" : 1457,
"total_bucket_processing_time_ms" : 1094.000000000001,
"minimum_bucket_processing_time_ms" : 0.0,
"maximum_bucket_processing_time_ms" : 48.0,
"average_bucket_processing_time_ms" : 0.75085792724777,
"exponential_average_bucket_processing_time_ms" : 0.5571716855800993,
"exponential_average_bucket_processing_time_per_hour_ms" : 15.0
}
}
]
}
----