分析
profile API 操作返回 ML 任务和模型的运行时信息。profile 操作可以帮助调试模型运行时问题。
返回的请求数量
默认情况下,Profile API 监控最近 100 个请求。要更改监控请求的数量,请更新以下集群设置
PUT _cluster/settings
{
"persistent" : {
"plugins.ml_commons.monitoring_request_count" : 1000000
}
}
要清除所有监控请求,请将 plugins.ml_commons.monitoring_request_count
设置为 0
。
端点
GET /_plugins/_ml/profile
GET /_plugins/_ml/profile/models
GET /_plugins/_ml/profile/models/<model_id>
GET /_plugins/_ml/profile/tasks
GET /_plugins/_ml/profile/tasks/<task_id>
路径参数
参数 | 数据类型 | 描述 |
---|---|---|
model_id | 字符串 | 返回特定模型的运行时数据。您可以提供多个以逗号分隔的模型 ID,以检索多个模型配置文件。 |
task_id | 字符串 | 返回特定任务的运行时数据。您可以提供多个以逗号分隔的任务 ID,以检索多个任务配置文件。 |
请求正文字段
所有 profile 请求体字段都是可选的。
字段 | 数据类型 | 描述 |
---|---|---|
node_ids | 字符串 | 返回特定节点上的所有任务和配置文件。 |
model_ids | 字符串 | 返回特定模型的运行时数据。您可以将多个模型 ID 组合在一起以返回多个模型配置文件。 |
task_ids | 字符串 | 返回特定任务的运行时数据。您可以将多个任务 ID 组合在一起以返回多个任务配置文件。 |
return_all_tasks | 布尔型 | 确定请求是否返回所有任务。当设置为 false 时,响应中将不包含任务配置文件。 |
return_all_models | 布尔型 | 确定 profile 请求是否返回所有模型。当设置为 false 时,响应中将不包含模型配置文件。 |
示例请求:返回特定节点上的所有任务和模型
GET /_plugins/_ml/profile
{
"node_ids": ["KzONM8c8T4Od-NoUANQNGg"],
"return_all_tasks": true,
"return_all_models": true
}
示例响应
{
"nodes" : {
"qTduw0FJTrmGrqMrxH0dcA" : { # node id
"models" : {
"WWQI44MBbzI2oUKAvNUt" : { # model id
"worker_nodes" : [ # routing table
"KzONM8c8T4Od-NoUANQNGg"
]
}
}
},
...
"KzONM8c8T4Od-NoUANQNGg" : { # node id
"models" : {
"WWQI44MBbzI2oUKAvNUt" : { # model id
"model_state" : "DEPLOYED", # model status
"predictor" : "org.opensearch.ml.engine.algorithms.text_embedding.TextEmbeddingModel@592814c9",
"worker_nodes" : [ # routing table
"KzONM8c8T4Od-NoUANQNGg"
],
"predict_request_stats" : { # predict request stats on this node
"count" : 2, # total predict requests on this node
"max" : 89.978681, # max latency in milliseconds
"min" : 5.402,
"average" : 47.6903405,
"p50" : 47.6903405,
"p90" : 81.5210129,
"p99" : 89.13291418999998
}
}
}
},
...
}
}