Loading...
Loading...
Compare original and translation side by side
aliyun emas-appmonitorGetIssues → GetIssue → GetErrors → GetError
↓
(optional) stack ↔ user APP source → precise file:line + fix diffcrashanrlagcustommemory_leakmemory_allocandroidiphoneosharmonyharmonyanrmemory_*aliyun emas-appmonitorGetIssues → GetIssue → GetErrors → GetError
↓
(可选) 堆栈 ↔ 用户APP源码 → 精准定位文件:行号 + 修复差异crashanrlagcustommemory_leakmemory_allocandroidiphoneosharmonyharmonyanrmemory_*| Item | Requirement | Self-check command |
|---|---|---|
| Aliyun CLI version | >= | |
| Plugin | | |
| jq | any version (required by scripts) | |
references/cli-installation-guide.mdaliyun configure set --auto-plugin-install true
aliyun plugin update| 项 | 要求 | 自检命令 |
|---|---|---|
| Aliyun CLI版本 | >= | |
| 插件 | | |
| jq | 任意版本(脚本依赖) | |
references/cli-installation-guide.mdaliyun configure set --auto-plugin-install true
aliyun plugin updatealiyun configure listcurrentModeRegionIdreferences/cli-installation-guide.md#ConfigurationThis skill never reads or forwards AK / SK field values themselves during its whole lifecycle.
aliyun configure listcurrentModeRegionIdreferences/cli-installation-guide.md#Configuration本技能在整个生命周期内绝不会读取或转发AK/SK字段值本身。
aliyun configure ai-mode enable
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-emas-apm-query"aliyun configure ai-mode disablealiyun configure ai-mode enable
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-emas-apm-query"aliyun configure ai-mode disableemasha:View*ViewIssuesViewIssueViewErrorsViewErroremashaResource"*"AliyunEMASAppMonitorReadOnlyAccessAliyunEMASAppMonitorFullAccessreferences/ram-policies.md[MUST] Permission Failure Handling: When any command or API call fails due to permission errors at any point during execution, follow this process:
- Read
to get the full list of permissions required by this SKILLreferences/ram-policies.md- Use
skill to guide the user through requesting the necessary permissionsram-permission-diagnose- Pause and wait until the user confirms that the required permissions have been granted
emasha:View*ViewIssuesViewIssueViewErrorsViewErroremashaResource"*"AliyunEMASAppMonitorReadOnlyAccessAliyunEMASAppMonitorFullAccessreferences/ram-policies.md[必须遵守] 权限失败处理:若执行过程中任何命令或API调用因权限错误失败,请遵循以下流程:
- 阅读
获取本技能所需的完整权限列表references/ram-policies.md- 使用
技能引导用户申请必要权限ram-permission-diagnose- 暂停并等待用户确认权限已授予
IMPORTANT: Parameter Confirmation — Before executing any command or API call, ALL user-customizable parameters (e.g., RegionId, instance names, CIDR blocks, passwords, domain names, resource specifications, etc.) MUST be confirmed with the user. Do NOT assume or use default values without explicit user approval.
| Parameter | Required | Type | Description | Default |
|---|---|---|---|---|
| Yes | int64 | EMAS APP Key (typically 9+ digits). Prefer to infer from SDK initialization code in the current workspace (see the 6 rule families in | None (default: probed from workspace) |
| Yes | enum | | None (default: probed from project type) |
| Yes | object | | Last 24 hours (user-overridable) |
| No | list | If omitted, all 6 modules are scanned; if specified, only that module is analyzed | All 6 |
| No | string | If the user already knows a specific Issue, skip the Top-N stage and drill down directly | None |
| No | int | Number of Top issues | |
| No | string | Further narrow down (specific version / device model / region ...), a JSON string | Not applied |
biz-module--helpexception / crash / lag / custom / h5JsError / h5WhiteScreenanr / memory_leak / memory_allocreferences/biz-module-reference.mdtime-rangeGranularity=60 GranularityUnit=MINUTECode: 200, Message: "unknown error"Granularity=1 GranularityUnit=DAYGranularityUnit=HOUR--os--help--osModel.Items=[]Total=0--os--didget-error--did--helpCode: 100011 Parameter Not Enoughget-errorsItems[*].Diddig_issue.shaliyun emas-appmonitor get-errorDigestHashget-errorsItems[*].DigestHash--digest-hashget-errorget-issuesget-issuebiz-modulebizModuleget-issuesget-issueget-errorsget-errorDigestHashlist_top_issues.shbm重要:参数确认 — 在执行任何命令或API调用前, 所有用户可自定义的参数(如RegionId、实例名称、CIDR块、 密码、域名、资源规格等)必须与用户确认。未经用户明确批准,请勿假设或使用默认值。
| 参数 | 是否必填 | 类型 | 描述 | 默认值 |
|---|---|---|---|---|
| 是 | int64 | EMAS AppKey(通常为9位以上数字)。优先从当前工作区的SDK初始化代码中推断(参考 | 无(默认:从工作区探测) |
| 是 | 枚举值 | | 无(默认:从项目类型探测) |
| 是 | 对象 | | 最近24小时(用户可覆盖) |
| 否 | 列表 | 若省略,扫描全部6个模块;若指定,仅分析该模块 | 全部6个 |
| 否 | 字符串 | 若用户已明确某个特定问题,跳过Top-N阶段直接钻取详情 | 无 |
| 否 | 整数 | Top问题数量 | |
| 否 | 字符串 | 进一步缩小范围(特定版本/设备型号/地区...),为JSON字符串 | 不应用 |
biz-module--helpexception / crash / lag / custom / h5JsError / h5WhiteScreenanr / memory_leak / memory_allocreferences/biz-module-reference.mdtime-rangeGranularity=60 GranularityUnit=MINUTECode: 200, Message: "unknown error"Granularity=1 GranularityUnit=DAYGranularityUnit=HOUR--os--help--osModel.Items=[]Total=0--os--didget-error--did--helpCode: 100011 Parameter Not Enoughget-errorsItems[*].Diddig_issue.shaliyun emas-appmonitor get-errorDigestHashget-errorsItems[*].DigestHash--digest-hashget-errorget-issuesget-issuebiz-moduleget-issuesbizModuleget-issueget-errorsget-errorDigestHashlist_top_issues.shbmflowchart TD
Start[User request] --> DetectCtx{Workspace can infer AppKey+OS?}
DetectCtx -- single match --> ConfirmCtx[Echo for user confirmation]
DetectCtx -- multiple matches --> PickCtx[List candidates, let user pick]
DetectCtx -- miss --> AskCtx[Ask user for AppKey + OS]
ConfirmCtx --> HasHash
PickCtx --> HasHash
AskCtx --> HasHash
HasHash{digestHash provided?}
HasHash -- yes --> SingleIssue[get-issue: fetch single Issue metadata]
HasHash -- no --> ParallelIssues[Parallel get-issues over 6 bizModules]
ParallelIssues --> TopN[Sort by errorRate, take Top 3-5]
TopN --> IterateTop[Iterate Top Issues]
IterateTop --> SingleIssue
SingleIssue --> GetErrors[get-errors: latest 3-5 samples]
GetErrors --> PickSample["Sample policy: latest / hot device / latest affected version"]
PickSample --> GetError[get-error: stack/threads/logs/dimensions]
GetError --> HasCode{CWD has APP source?}
HasCode -- yes --> CodeMatch[stack -> file + line -> diff]
HasCode -- no --> CliReport[CLI-only diagnostic report]
CodeMatch --> Report[Final report: issue list + root cause + fix]
CliReport --> Report
Report --> CallFailed{Any CLI call failed?}
CallFailed -- yes --> CliSelfDiag["CLI self-diagnose: --log-level debug / --cli-dry-run / configure list / plugin update"]
CallFailed -- no --> endNode[Done]
CliSelfDiag --> endNodeflowchart TD
Start[用户请求] --> DetectCtx{工作区可推断AppKey+OS?}
DetectCtx -- 唯一匹配 --> ConfirmCtx[告知用户并等待确认]
DetectCtx -- 多个匹配 --> PickCtx[列出候选,让用户选择]
DetectCtx -- 未找到 --> AskCtx[请求用户提供AppKey + OS]
ConfirmCtx --> HasHash
PickCtx --> HasHash
AskCtx --> HasHash
HasHash{是否提供digestHash?}
HasHash -- 是 --> SingleIssue[get-issue: 获取单个问题元数据]
HasHash -- 否 --> ParallelIssues[并行调用6个bizModule的get-issues]
ParallelIssues --> TopN[按errorRate排序,选取Top 3-5]
TopN --> IterateTop[遍历Top问题]
IterateTop --> SingleIssue
SingleIssue --> GetErrors[get-errors: 获取最新3-5个样本]
GetErrors --> PickSample["样本策略:最新/热门设备/最新受影响版本"]
PickSample --> GetError[get-error: 获取堆栈/线程/日志/维度信息]
GetError --> HasCode{当前目录是否有APP源码?}
HasCode -- 是 --> CodeMatch[堆栈 -> 文件+行号 -> 差异分析]
HasCode -- 否 --> CliReport[仅CLI诊断报告]
CodeMatch --> Report[最终报告:问题列表 + 根因分析 + 修复方案]
CliReport --> Report
Report --> CallFailed{是否有CLI调用失败?}
CallFailed -- 是 --> CliSelfDiag["CLI自诊断:--log-level debug / --cli-dry-run / configure list / plugin update"]
CallFailed -- 否 --> endNode[完成]
CliSelfDiag --> endNode$SKILL_DIR$SKILL_DIRfullPathpath<available_skills>scripts/assets/references/SKILL_DIRundefined<available_skills>fullPathpathscripts/assets/references/SKILL_DIRundefined
Rules:
1. **Do not hardcode `~/.cursor/skills-cursor/...` or `~/.claude/skills/...`**: this Skill can be distributed in the repository (`.agent/skills/alibabacloud-emas-apm-query/`) or at the user level, and the absolute path varies with the host.
2. **Do not rely on `cd` into the Skill directory to use relative paths**: the scripts drop artifacts into the current working directory (the user's APP source root); `cd` would break this semantic.
3. **The bash scripts have a fallback**: `scripts/list_top_issues.sh` and `scripts/dig_issue.sh` auto-detect their own location via `BASH_SOURCE` at the top, so they can locate `$SKILL_DIR` even if it was not exported. Other inline `jq` / `rg` commands inside SKILL.md still require the Agent to export `$SKILL_DIR` first.
规则:
1. **请勿硬编码`~/.cursor/skills-cursor/...`或`~/.claude/skills/...`**:本技能可分布在仓库(`.agent/skills/alibabacloud-emas-apm-query/`)或用户级别目录,绝对路径会随主机环境变化。
2. **请勿依赖`cd`进入技能目录使用相对路径**:脚本会将产物输出到当前工作目录(用户的APP源码根目录);`cd`会破坏此语义。
3. **bash脚本有 fallback 机制**:`scripts/list_top_issues.sh`和`scripts/dig_issue.sh`会在脚本顶部通过`BASH_SOURCE`自动检测自身位置,因此即使未导出`$SKILL_DIR`也能定位到该目录。但SKILL.md中的其他内联`jq`/`rg`命令仍需Agent先导出`$SKILL_DIR`。digest-hashdigest-hashscripts/list_top_issues.shbash "$SKILL_DIR/scripts/list_top_issues.sh" \
--app-key <AppKey> \
--os <iphoneos|android|harmony> \
--start-time <startMs> \
--end-time <endMs> \
--top-n 5 \
--order-by ErrorRate{bm, digestHash, ec, er, edc, edr, name, type, reason}--filter-json '{"Key":"appVersion","Operator":"in","Values":["3.5.0","3.5.1"]}'references/filter-reference.mdscripts/list_top_issues.shbash "$SKILL_DIR/scripts/list_top_issues.sh" \
--app-key <AppKey> \
--os <iphoneos|android|harmony> \
--start-time <起始毫秒> \
--end-time <结束毫秒> \
--top-n 5 \
--order-by ErrorRate{bm, digestHash, ec, er, edc, edr, name, type, reason}--filter-json '{"Key":"appVersion","Operator":"in","Values":["3.5.0","3.5.1"]}'references/filter-reference.mdscripts/dig_issue.shbash "$SKILL_DIR/scripts/dig_issue.sh" \
--app-key <AppKey> \
--os <iphoneos|android|harmony> \
--biz-module <crash|anr|lag|custom|memory_leak|memory_alloc> \
--digest-hash <13-char Base36> \
--start-time <startMs> --end-time <endMs> \
--sample-size 3emas-apm-dig-<AppKey>-<DigestHash>-<epoch>/
01-get-issue.json
02-get-errors.json (contains the ClientTime/Uuid/Did triples)
samples/<Uuid>.json (complete JSON per sample, includes Backtrace/EventLog etc.)
report.md (structured markdown report)scripts/dig_issue.shbash "$SKILL_DIR/scripts/dig_issue.sh" \
--app-key <AppKey> \
--os <iphoneos|android|harmony> \
--biz-module <crash|anr|lag|custom|memory_leak|memory_alloc> \
--digest-hash <13位Base36哈希> \
--start-time <起始毫秒> --end-time <结束毫秒> \
--sample-size 3emas-apm-dig-<AppKey>-<DigestHash>-<时间戳>/
01-get-issue.json
02-get-errors.json (包含ClientTime/Uuid/Did三元组)
samples/<Uuid>.json (每个样本的完整JSON,包含Backtrace/EventLog等)
report.md (结构化Markdown报告)references/troubleshoot-workflow.mdModel.BacktraceEventLogControllersThreadsCustomInforeferences/troubleshoot-workflow.mdModel.BacktraceEventLogControllersThreadsCustomInfoaliyun emas-appmonitoraliyun configure list # 1. current profile / mode / region
aliyun plugin update # 2. latest plugin
aliyun emas-appmonitor <cmd> ... --cli-dry-run # 3. parameter serialization check
aliyun emas-appmonitor <cmd> ... --log-level debug # 4. HTTP body + RequestIdaliyun emas-appmonitoraliyun configure list # 1. 当前配置文件/模式/地域
aliyun plugin update # 2. 更新到最新插件
aliyun emas-appmonitor <cmd> ... --cli-dry-run # 3. 参数序列化检查
aliyun emas-appmonitor <cmd> ... --log-level debug # 4. 查看HTTP请求体+RequestIdreferences/verification-method.mdreferences/acceptance-criteria.mdget-issuesModel.Total >= 1DigestHashTotalissues → issue → errors → errorRequestIdErrorCodereferences/verification-method.mdreferences/acceptance-criteria.mdget-issuesModel.Total >= 1DigestHashTotalissues → issue → errors → errorRequestIdErrorCodealiyun configure ai-mode disablealiyun configure ai-mode disableundefinedundefinedreferences/appkey-detection.mdapp-keyosdig_issue.shlist_top_issues.shO(N)O(all)--os--os--helpandroid / iphoneos / harmonyget-error--did--helpItems[*].Didget-errorsbiz-moduleget-issueget-errorsget-errorget-issuesGranularity=1 GranularityUnit=DAYGranularityUnit=HOUR--filterSubFiltersjq -cnreferences/filter-reference.mdaliyun configure list--profile <name>get-errorheadtail> /tmp/emas-error-XXX.jsonjqa.a.a.b.cmapping.txtModel.SymbolicStatus=falseStacklist_top_issues.shsleep 0.3sbiz-moduleanr / memory_*harmonyTotal=0Get*View*UpdateIssueStatusreferences/appkey-detection.mdapp-keyosdig_issue.shlist_top_issues.shO(N)O(全部)--os--os--helpandroid / iphoneos / harmonyget-error--did--helpget-errorsItems[*].Didbiz-moduleget-issueget-errorsget-errorget-issuesGranularity=1 GranularityUnit=DAYGranularityUnit=HOUR--filterjq -cnSubFiltersreferences/filter-reference.mdaliyun configure list--profile <名称>get-errorheadtail> /tmp/emas-error-XXX.jsonjqa.a.a.b.cmapping.txtModel.SymbolicStatus=falseStacklist_top_issues.shsleep 0.3sbiz-moduleharmonyanr / memory_*Total=0Get*View*UpdateIssueStatus| Document | Purpose |
|---|---|
| Aliyun CLI installation / configuration / plugins / credentials |
| Identify AppKey and OS from the user's workspace across Android / iOS / Harmony / Flutter / Unity / H5 |
| Least-privilege JSON + Permission Failure Handling |
| |
| |
| |
| |
| |
| 6 biz_modules x platforms x available |
| Full flow for stack -> source -> diff |
| Cheat sheet for all |
| 6-step runnable CLI verification with pass/fail criteria |
| Correct vs incorrect CLI pattern matrix (for review / self-check) |
| Index of 14 static filter snapshots (biz_module x platform) |
| 文档 | 用途 |
|---|---|
| Aliyun CLI安装/配置/插件/凭证 |
| 从用户工作区识别Android/iOS/Harmony/Flutter/Unity/H5的AppKey和操作系统 |
| 最小权限JSON策略 + 权限失败处理 |
| |
| |
| |
| |
| |
| 6个biz_module x 平台 x 可用 |
| 堆栈→源码→差异分析的完整流程 |
| 所有 |
| 6步可运行CLI验证流程及通过/失败标准 |
| 正确与错误CLI模式矩阵(用于评审/自检) |
| 14个静态过滤快照索引(biz_module x 平台) |