arms_generate_trace_query
Converts natural language queries into ARMS trace query statements for analyzing application performance and execution paths in Alibaba Cloud.
Instructions
生成ARMS应用的调用链查询语句。
## 功能概述
该工具用于将自然语言描述转换为ARMS调用链查询语句,便于分析应用性能和问题。
## 使用场景
- 当需要查询应用的调用链信息时
- 当需要分析应用性能问题时
- 当需要跟踪特定请求的执行路径时
- 当需要分析服务间调用关系时
## 查询处理
工具会将自然语言问题转换为SLS查询,并返回:
- 生成的SLS查询语句
- 存储调用链数据的项目名
- 存储调用链数据的日志库名
## 查询上下文
查询会考虑以下信息:
- 应用的PID
- 响应时间以纳秒存储,需转换为毫秒
- 数据以span记录存储,查询耗时需要对符合条件的span进行求和
- 服务相关信息使用serviceName字段
- 如果用户明确提出要查询 trace信息,则需要在查询问题上question 上添加说明返回trace信息
## 查询示例
- "帮我查询下 XXX 的 trace 信息"
- "分析最近一小时内响应时间超过1秒的调用链"
Args:
ctx: MCP上下文,用于访问ARMS和SLS客户端
user_id: 用户阿里云账号ID
pid: 应用的PID
region_id: 阿里云区域ID
question: 查询调用链的自然语言问题
Returns:
包含查询信息的字典,包括sls_query、project和log_store
Input Schema
Name | Required | Description | Default |
---|---|---|---|
pid | Yes | pid,the pid of the app | |
question | Yes | question,the question to query the trace | |
region_id | Yes | region id,region id format like 'xx-xxx',like 'cn-hangzhou' | |
user_id | Yes | user aliyun account id |
Input Schema (JSON Schema)
{
"properties": {
"pid": {
"description": "pid,the pid of the app",
"title": "Pid",
"type": "string"
},
"question": {
"description": "question,the question to query the trace",
"title": "Question",
"type": "string"
},
"region_id": {
"description": "region id,region id format like 'xx-xxx',like 'cn-hangzhou'",
"title": "Region Id",
"type": "string"
},
"user_id": {
"description": "user aliyun account id",
"title": "User Id",
"type": "integer"
}
},
"required": [
"user_id",
"pid",
"region_id",
"question"
],
"title": "arms_generate_trace_queryArguments",
"type": "object"
}