alibabacloud-emas-apm-query
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesealibabacloud-emas-apm-query
阿里云EMAS APM查询工具
1. Scenario Description & Architecture
1. 场景说明与架构
After a mobile app integrates Alibaba Cloud EMAS APM, the crash / anr / lag / custom / memory_leak / memory_alloc events it produces every day are aggregated and reported by the SDK to the backend. A typical troubleshooting workflow is:
- Figure out which Issues are most worth fixing: sort by error rate / error count → pick Top 3~5
- Inspect what a specific Issue looks like: fetch its aggregated metrics and affected versions
- Find several representative samples: across different devices / versions / networks
- Read the stack + business log in a sample: find actionable clues
- Compare against the app source code and propose a fix
This skill stitches the 5 steps above into a single CLI pipeline. The entire process only calls the 4 read-only APIs of , and depends on no database / log service:
aliyun emas-appmonitorGetIssues → GetIssue → GetErrors → GetError
↓
(optional) stack ↔ user APP source → precise file:line + fix diffSupported BizModules: / / / / /
Supported OS: / / ( does not have / )
crashanrlagcustommemory_leakmemory_allocandroidiphoneosharmonyharmonyanrmemory_*移动应用集成阿里云EMAS APM后,每日产生的崩溃(crash)、应用无响应(anr)、卡顿(lag)、自定义异常(custom)、内存泄漏(memory_leak)、内存分配(memory_alloc)事件会由SDK聚合上报至后端。典型的排查流程如下:
- 确定最需修复的问题:按错误率/错误数排序 → 选取Top 3~5
- 查看特定问题的概况:获取其聚合指标和受影响版本
- 选取代表性样本:覆盖不同设备/版本/网络环境
- 查看样本的堆栈+业务日志:寻找可操作线索
- 对比应用源代码并提出修复方案
本技能将上述5个步骤整合为一条CLI流水线。整个流程仅调用的4个只读API,无需依赖数据库或日志服务:
aliyun emas-appmonitorGetIssues → GetIssue → GetErrors → GetError
↓
(可选) 堆栈 ↔ 用户APP源码 → 精准定位文件:行号 + 修复差异支持的业务模块: / / / / /
支持的操作系统: / / (不支持 / 模块)
crashanrlagcustommemory_leakmemory_allocandroidiphoneosharmonyharmonyanrmemory_*2. Prerequisites
2. 前置条件
| Item | Requirement | Self-check command |
|---|---|---|
| Aliyun CLI version | >= | |
| Plugin | | |
| jq | any version (required by scripts) | |
Full installation steps: . Recommended: enable auto plugin installation once:
references/cli-installation-guide.mdbash
aliyun configure set --auto-plugin-install true
aliyun plugin update| 项 | 要求 | 自检命令 |
|---|---|---|
| Aliyun CLI版本 | >= | |
| 插件 | | |
| jq | 任意版本(脚本依赖) | |
完整安装步骤:。推荐:一次性开启自动插件安装:
references/cli-installation-guide.mdbash
aliyun configure set --auto-plugin-install true
aliyun plugin update3. Credential Pre-check
3. 凭证预检查
Do NOT print AK/SK values; just verify that an available profile exists:
bash
aliyun configure listThe expected output contains a profile whose / are non-empty. If not, configure one of AK / OAuth / StsToken / RamRoleArn per .
currentModeRegionIdreferences/cli-installation-guide.md#ConfigurationThis skill never reads or forwards AK / SK field values themselves during its whole lifecycle.
请勿打印AK/SK值;仅需验证是否存在可用的配置文件:
bash
aliyun configure list预期输出应包含一个配置文件,其/不为空。若不存在,请按照配置AK/OAuth/StsToken/RamRoleArn中的一种。
currentModeRegionIdreferences/cli-installation-guide.md#Configuration本技能在整个生命周期内绝不会读取或转发AK/SK字段值本身。
4. AI-mode Lifecycle
4. AI模式生命周期
Start (before the skill runs):
bash
aliyun configure ai-mode enable
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-emas-apm-query"End (after troubleshooting completes):
bash
aliyun configure ai-mode disable启动(技能运行前):
bash
aliyun configure ai-mode enable
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-emas-apm-query"结束(排查完成后):
bash
aliyun configure ai-mode disable5. RAM Permissions
5. RAM权限
This skill only needs the 4 read-only actions ( / / / ). EMAS AppMonitor's RamCode is and does not support resource-level authorization, so is fixed to .
emasha:View*ViewIssuesViewIssueViewErrorsViewErroremashaResource"*"For the full least-privilege JSON policy, the equivalent system policies ( / ), and common permission-error troubleshooting, see .
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
本技能仅需4个只读的操作权限( / / / )。EMAS AppMonitor的RamCode为,且不支持资源级授权,因此固定为。
emasha:View*ViewIssuesViewIssueViewErrorsViewErroremashaResource"*"关于最小权限JSON策略、等效系统策略( / )以及常见权限问题排查,请参考。
AliyunEMASAppMonitorReadOnlyAccessAliyunEMASAppMonitorFullAccessreferences/ram-policies.md[必须遵守] 权限失败处理:若执行过程中任何命令或API调用因权限错误失败,请遵循以下流程:
- 阅读
获取本技能所需的完整权限列表references/ram-policies.md- 使用
技能引导用户申请必要权限ram-permission-diagnose- 暂停并等待用户确认权限已授予
6. Parameter Confirmation
6. 参数确认
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 |
Timestamp unit: every API uses Unix milliseconds. If the user passes a value in seconds (< 1e12), the scripts will automatically multiply by 1000.
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-errorDual semantics of : returns , which is the hash of a single event, different from the aggregated you passed in. When calling next, still use the aggregated hash (the one you used in / ); do not switch to the single-event hash.
DigestHashget-errorsItems[*].DigestHash--digest-hashget-errorget-issuesget-issueReuse : whichever was used to obtain a Top Issue from must be reused for the next three steps ( / / ); otherwise the response will be empty (the same exists under only one bizModule). already attaches a field to each row so it can be reused.
biz-modulebizModuleget-issuesget-issueget-errorsget-errorDigestHashlist_top_issues.shbm重要:参数确认 — 在执行任何命令或API调用前, 所有用户可自定义的参数(如RegionId、实例名称、CIDR块、 密码、域名、资源规格等)必须与用户确认。未经用户明确批准,请勿假设或使用默认值。
| 参数 | 是否必填 | 类型 | 描述 | 默认值 |
|---|---|---|---|---|
| 是 | int64 | EMAS AppKey(通常为9位以上数字)。优先从当前工作区的SDK初始化代码中推断(参考 | 无(默认:从工作区探测) |
| 是 | 枚举值 | | 无(默认:从项目类型探测) |
| 是 | 对象 | | 最近24小时(用户可覆盖) |
| 否 | 列表 | 若省略,扫描全部6个模块;若指定,仅分析该模块 | 全部6个 |
| 否 | 字符串 | 若用户已明确某个特定问题,跳过Top-N阶段直接钻取详情 | 无 |
| 否 | 整数 | Top问题数量 | |
| 否 | 字符串 | 进一步缩小范围(特定版本/设备型号/地区...),为JSON字符串 | 不应用 |
时间戳单位:所有API均使用Unix毫秒。若用户传入秒级数值(< 1e12),脚本会自动乘以1000转换为毫秒。
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-issue复用:从获取Top问题时使用的,必须在后续三个步骤(//)中复用;否则会返回空响应(同一个仅存在于一个bizModule下)。已为每一行附加字段以便复用。
biz-moduleget-issuesbizModuleget-issueget-errorsget-errorDigestHashlist_top_issues.shbm7. Core Workflow
7. 核心流程
mermaid
flowchart 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 --> endNodemermaid
flowchart 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 --> endNode7.0 Runtime locate the Skill directory ($SKILL_DIR
)
$SKILL_DIR7.0 运行时定位技能目录($SKILL_DIR
)
$SKILL_DIRThe Skill's own path is known to the Agent at the time SKILL.md is loaded (see the / field under in the context). Before running any bash command that needs to read bundled resources from this Skill ( / / ), the Agent MUST first export the directory of SKILL.md to exactly once:
fullPathpath<available_skills>scripts/assets/references/SKILL_DIRbash
undefinedAgent加载SKILL.md时会知晓技能自身路径(参考上下文下的/字段)。在运行任何需要读取本技能捆绑资源(//)的bash命令前,Agent必须先将SKILL.md所在目录导出为,且仅需执行一次:
<available_skills>fullPathpathscripts/assets/references/SKILL_DIRbash
undefinedThe Agent fills in the absolute path of SKILL.md into the placeholder, then exports once
Agent将SKILL.md的绝对路径填入占位符,然后导出一次
export SKILL_DIR="$(cd "$(dirname "<ABSOLUTE_PATH_OF_SKILL.md>")" && pwd)"
export SKILL_DIR="$(cd "$(dirname "<ABSOLUTE_PATH_OF_SKILL.md>")" && pwd)"
Self-check: all three directories must exist
自检:三个目录必须存在
[[ -d "$SKILL_DIR/scripts" && -d "$SKILL_DIR/assets" && -d "$SKILL_DIR/references" ]]
|| { echo "[ERROR] SKILL_DIR does not point to the root of this Skill: $SKILL_DIR" >&2; exit 1; }
|| { echo "[ERROR] SKILL_DIR does not point to the root of this Skill: $SKILL_DIR" >&2; exit 1; }
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.[[ -d "$SKILL_DIR/scripts" && -d "$SKILL_DIR/assets" && -d "$SKILL_DIR/references" ]]
|| { echo "[ERROR] SKILL_DIR未指向本技能根目录:$SKILL_DIR" >&2; exit 1; }
|| { echo "[ERROR] SKILL_DIR未指向本技能根目录:$SKILL_DIR" >&2; exit 1; }
规则:
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`。7.1 Stage A: Top N (when digest-hash
is not provided)
digest-hash7.1 阶段A:Top N(未提供digest-hash
时)
digest-hashUse to scan the 6 biz_modules in parallel:
scripts/list_top_issues.shbash
bash "$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 ErrorRateThe output is a merged Top-N table, each row containing .
To add a Filter (e.g. "only version 3.5.x"), append ; see .
{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.md使用并行扫描6个biz_modules:
scripts/list_top_issues.shbash
bash "$SKILL_DIR/scripts/list_top_issues.sh" \
--app-key <AppKey> \
--os <iphoneos|android|harmony> \
--start-time <起始毫秒> \
--end-time <结束毫秒> \
--top-n 5 \
--order-by ErrorRate输出为合并后的Top-N表格,每行包含。如需添加过滤条件(例如“仅版本3.5.x”),追加;详情参考。
{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.md7.2 Stage B: Drill into a single Issue
7.2 阶段B:钻取单个问题详情
Use :
scripts/dig_issue.shbash
bash "$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 3Output directory:
emas-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
bash "$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 3输出目录:
emas-apm-dig-<AppKey>-<DigestHash>-<时间戳>/
01-get-issue.json
02-get-errors.json (包含ClientTime/Uuid/Did三元组)
samples/<Uuid>.json (每个样本的完整JSON,包含Backtrace/EventLog等)
report.md (结构化Markdown报告)7.3 Stage C: Code mapping + diff (if the CWD contains APP source)
7.3 阶段C:代码映射+差异分析(当前目录包含APP源码时)
Follow :
references/troubleshoot-workflow.md- Determine the platform (Android / iOS / Harmony / RN / Flutter / Web)
- → keep APP user frames → grep the source → locate file:line
Model.Backtrace - Enrich the timeline using +
EventLog+Controllers+ThreadsCustomInfo - Emit the smallest diff (≤ 20 lines + one sentence of "why")
If the CWD does not contain the source: emit only a CLI diagnostic report (Issue overview, sample dimension comparison, representative stack), and append a hint that "switching to the APP source directory enables code-level localization".
遵循:
references/troubleshoot-workflow.md- 确定平台(Android / iOS / Harmony / RN / Flutter / Web)
- → 保留APP用户代码栈帧 → 搜索源码 → 定位文件:行号
Model.Backtrace - 使用+
EventLog+Controllers+Threads丰富时间线CustomInfo - 生成最小差异代码(≤20行 + 一句“原因说明”)
若当前目录不包含源码:仅生成CLI诊断报告(问题概览、样本维度对比、代表性堆栈),并附加提示“切换到APP源码目录可启用代码级定位”。
7.4 Failure handling (CLI only)
7.4 故障处理(仅CLI)
When any call fails, run the following self-checks in order:
aliyun emas-appmonitorbash
aliyun 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 + RequestIdDo not guide the user to query any server-side data source.
当任何调用失败时,按顺序执行以下自检步骤:
aliyun emas-appmonitorbash
aliyun configure list # 1. 当前配置文件/模式/地域
aliyun plugin update # 2. 更新到最新插件
aliyun emas-appmonitor <cmd> ... --cli-dry-run # 3. 参数序列化检查
aliyun emas-appmonitor <cmd> ... --log-level debug # 4. 查看HTTP请求体+RequestId请勿引导用户查询任何服务器端数据源。
8. Success Verification
8. 成功验证
The full 6-step CLI self-verification (with runnable commands and pass/fail criteria for each step) is in . The correct-vs-incorrect CLI pattern matrix is in . Core criteria:
references/verification-method.mdreferences/acceptance-criteria.md- Reachable: dry-run prints the HTTP body successfully
get-issues - Non-empty: some biz_module has
Model.Total >= 1 - Stable: two calls with identical parameters return the same Top 5
DigestHash - Filter works: after adding a filter, is strictly <= the full count
Total - Three-level chain: can pull a Stack end to end
issues → issue → errors → error - Diagnosable: on induced errors, the output includes and
RequestIdErrorCode
包含可运行命令和每步骤通过/失败标准的6步CLI完整自验证流程,请参考。正确与错误CLI模式矩阵请参考。核心标准:
references/verification-method.mdreferences/acceptance-criteria.md- 可访问:dry-run成功打印HTTP请求体
get-issues - 非空结果:至少一个biz_module的
Model.Total >= 1 - 稳定性:相同参数的两次调用返回相同的Top 5
DigestHash - 过滤生效:添加过滤条件后,严格小于等于未过滤时的总数
Total - 三级链路完整:可完整拉取到堆栈信息
issues → issue → errors → error - 可诊断:人为触发错误时,输出包含和
RequestIdErrorCode
9. Cleanup
9. 清理
This skill is read-only; it does not create any cloud resources that need cleanup.
Tear-down is only two things:
bash
aliyun configure ai-mode disable本技能为只读;不会创建任何需要清理的云资源。
仅需执行两项操作:
bash
aliyun configure ai-mode disable(optional) delete the local JSON directories produced by dig_issue.sh
(可选) 删除dig_issue.sh生成的本地JSON目录
rm -rf ./emas-apm-dig-*
undefinedrm -rf ./emas-apm-dig-*
undefined10. Best Practices
10. 最佳实践
- Probe first, ask later: before entering the main flow, grep SDK initialization code from the user's workspace per to infer
references/appkey-detection.md/app-key; confirm with the user only after a hit, rather than asking upfront.os - Top first, then drill: do not run against every Issue from the start — first use
dig_issue.shto aggregate the Top N, then drill into each of them. The total number of CLI calls islist_top_issues.shrather thanO(N).O(all) - Always pass :
--oson all 4 APIs is marked optional in--os, but omitting it returns empty results silently. Always specify--helpexplicitly.android / iphoneos / harmony - MUST carry
get-error: marked optional in--didbut implicitly required by the backend; take it from--helpin theItems[*].Didresponse.get-errors - Reuse : the next
biz-module/get-issue/get-errorscalls must use the same bizModule that produced the Issue inget-error; switching will return empty.get-issues - Shrink the time window from "wide" to "narrow": start diagnosis with 24h / ; once a specific version / device is located, shrink to 1~4 hours with
Granularity=1 GranularityUnit=DAY.GranularityUnit=HOUR - Filters are JSON strings: the entire value must be a single JSON string; build nested
--filterwithSubFiltersto avoid manual escape errors (seejq -cn).references/filter-reference.md - Multi-account scenarios: confirm the profile via and pass
aliyun configure listexplicitly rather than relying on implicit env-var switching.--profile <name> - Persist : this API response can be from hundreds of KB to several MB; do not truncate JSON with
get-error/head. Write totailfirst and then process with> /tmp/emas-error-XXX.json.jq - Android obfuscation: when you see class names like , ask the user for
a.a.a.b.cbefore attempting code mapping rather than guessing.mapping.txt - iOS not symbolicated: when , the
Model.SymbolicStatus=falsecontains many raw addresses; only emit conclusions at device / version dimensions, and re-analyze after dSYM is uploaded.Stack - Parallel QPS control: has a built-in
list_top_issues.shto avoid throttling; scanning 6 biz_modules takes 2~3 seconds in total and does not need extra concurrency.sleep 0.3s - Empty results are not errors:
biz-moduleunderanr / memory_*or very-low-traffic AppKeys returningharmonyis normal and should not be retried.Total=0 - Do not reverse-use this skill to write data: all 4 APIs are /
Get*. If the user wants to "update Issue status" or "mark as fixed", that falls under write APIs likeView*and is out of scope.UpdateIssueStatus
- 先探测,后询问:进入主流程前,按照从用户工作区搜索SDK初始化代码,推断
references/appkey-detection.md/app-key;找到匹配项后再与用户确认,而非直接询问。os - 先Top,后钻取:不要一开始就对所有问题运行— 先使用
dig_issue.sh聚合Top N问题,再逐个钻取详情。CLI调用总数为list_top_issues.sh而非O(N)。O(全部) - 始终传入:所有4个API的
--os在--os中标记为可选,但省略会静默返回空结果。请始终显式指定--help。android / iphoneos / harmony - 必须携带
get-error:在--did中标记为可选,但后端隐式要求必填;需从--help响应的get-errors中获取。Items[*].Did - 复用:后续
biz-module/get-issue/get-errors调用必须使用与get-error中生成该问题相同的bizModule;切换模块会返回空结果。get-issues - 时间窗口从“宽”到“窄”:诊断开始时使用24小时/;定位到特定版本/设备后,缩小到1~4小时并使用
Granularity=1 GranularityUnit=DAY。GranularityUnit=HOUR - 过滤条件为JSON字符串:整个值必须是单个JSON字符串;使用
--filter构建嵌套jq -cn以避免手动转义错误(参考SubFilters)。references/filter-reference.md - 多账号场景:通过确认配置文件,并显式传入
aliyun configure list,而非依赖隐式环境变量切换。--profile <名称> - 持久化结果:该API响应大小从数百KB到数MB不等;请勿使用
get-error/head截断JSON。先写入tail再用> /tmp/emas-error-XXX.json处理。jq - Android混淆处理:当看到这类类名时,先请求用户提供
a.a.a.b.c再尝试代码映射,而非猜测。mapping.txt - iOS未符号化处理:当时,
Model.SymbolicStatus=false包含大量原始地址;仅输出设备/版本维度的结论,上传dSYM后再重新分析。Stack - 并行QPS控制:内置
list_top_issues.sh避免限流;扫描6个biz_module总共耗时2~3秒,无需额外并发控制。sleep 0.3s - 空结果并非错误:
biz-module下的harmony模块或低流量AppKey返回anr / memory_*是正常现象,无需重试。Total=0 - 请勿反向使用本技能写入数据:所有4个API均为/
Get*类型。若用户想要“更新问题状态”或“标记为已修复”,属于View*等写入API,不在本技能范围内。UpdateIssueStatus
11. Reference Links
11. 参考链接
| 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 平台) |