Get trained models usage info
- GET /_ml/trained_models/{model_id}/_stats
- GET /_ml/trained_models/_stats
You can get usage information for multiple trained models in a single API request by using a comma-separated list of model IDs or a wildcard expression.
Required authorization
- Cluster privileges monitor_ml
Query parameters
-
allow_no_matchboolean · default: true -
Specifies what to do when the request:
- Contains wildcard expressions and there are no models that match.
- Contains the _all string or no identifiers and there are no matches.
- Contains wildcard expressions and there are only partial matches.
If true, it returns an empty array when there are no matches and the subset of results when there are partial matches.
Response
-
countnumberrequired -
The total number of trained model statistics that matched the requested ID patterns. Could be higher than the number of items in the trained_model_stats array as the size of the array is restricted by the supplied size parameter.
-
trained_model_statsobjectrequired -
An array of trained model statistics, which are sorted by the model_id value in ascending order.
-
deployment_statsobject -
A collection of deployment stats, which is present when the models are deployed.
-
allocation_statusobject -
The detailed allocation status for the deployment.
-
staterequired -
The detailed allocation state related to the nodes.
Supported values include:
started: The trained model is started on at least one node.starting: Trained model deployment is starting but it is not yet deployed on any nodes.fully_allocated: Trained model deployment has started on all valid nodes.
-
Values:
startedstartingfully_allocated -
nodesobjectrequired -
The deployment stats for each node that currently has the model allocated. In serverless, stats are reported for a single unnamed virtual node.
-
average_inference_time_ms_excluding_cache_hitsnumber -
The average time for each inference call to complete on this node, excluding cache
-
rejected_execution_countnumber -
The number of inference requests that were not processed because the queue was full.
-
routing_stateobjectrequired -
The current routing state and reason for the current routing state for this allocation.
-
reasonstring -
The reason for the current state. It is usually populated only when the
routing_stateisfailed. -
routing_staterequired -
The current routing state.
Supported values include:
failed: The allocation attempt failed.started: The trained model is allocated and ready to accept inference requests.starting: The trained model is attempting to allocate on this node; inference requests are not yet accepted.stopped: The trained model is fully deallocated from this node.stopping: The trained model is being deallocated from this node.
-
Values:
failedstartedstartingstoppedstopping -
queue_capacitynumber -
The number of inference requests that can be queued before new requests are rejected.
-
rejected_execution_countnumber -
The sum of
rejected_execution_countfor all nodes in the deployment. Individual nodes reject an inference request if the inference queue is full. The queue size is controlled by thequeue_capacitysetting in the start trained model deployment API. -
reasonstring -
The reason for the current deployment state. Usually only populated when the model is not deployed to a node.
-
state -
The overall state of the deployment.
Supported values include:
started: The deployment is usable; at least one node has the model allocated.starting: The deployment has recently started but is not yet usable; the model is not allocated on any nodes.stopping: The deployment is preparing to stop and deallocate the model from the relevant nodes.failed: The deployment is on a failed state and must be re-deployed.
-
Values:
startedstartingstoppingfailed -
inference_statsobject -
A collection of inference stats fields.
-
cache_miss_countnumberrequired -
The number of times the model was loaded for inference and was not retrieved from the cache. If this number is close to the
inference_count, the cache is not being appropriately used. This can be solved by increasing the cache size or its time-to-live (TTL). Refer to general machine learning settings for the appropriate settings. -
inference_countnumberrequired -
The total number of times the model has been called for inference. This is across all inference contexts, including all pipelines.
-
ingestmap string to object -
A collection of ingest stats for the model across all nodes. The values are summations of the individual node statistics. The format matches the ingest section in the nodes stats API.