Loading...
Loading...
Alibaba Cloud EMAS APM (mobile Application Performance Monitoring) issue troubleshooting skill. Covers the 4 read-only OpenAPIs exposed by the `aliyun emas-appmonitor` plugin: `get-issues` / `get-issue` / `get-errors` / `get-error`. Capabilities: Top-N aggregation, sample stack drill-down and dimension breakdowns for 6 issue types (crash / anr / lag / custom / memory_leak / memory_alloc), combined with the user's source code (Java / Kotlin / Objective-C / Swift / ArkTS / Dart / C# / JS) to produce root cause analysis and fix suggestions. Client coverage: native Android / iOS / HarmonyOS, Flutter, Unity (bundled to android / iphoneos / harmony; H5 is out of scope). Triggers: analyze app crash, troubleshoot ANR, APM crash investigation, list top issues, "what is this digestHash", iOS ANR Top 5, Android memory leak analysis, Flutter custom exception stacks, pull lag samples, emas appmonitor usage, sort issues by error rate, map stack to source, appKey problem, EMAS APM issue analysis, analyze APM issues.
npx skill4agent add aliyun/alibabacloud-aiops-skills alibabacloud-emas-apm-queryaliyun emas-appmonitorGetIssues → GetIssue → GetErrors → GetError
↓
(optional) stack ↔ user APP source → precise file:line + fix diffcrashanrlagcustommemory_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 updatealiyun configure listcurrentModeRegionIdreferences/cli-installation-guide.md#ConfigurationThis skill never reads or forwards AK / SK field values themselves during its whole lifecycle.
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 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
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.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 --> endNode$SKILL_DIRfullPathpath<available_skills>scripts/assets/references/SKILL_DIR# The Agent fills in the absolute path of SKILL.md into the placeholder, then exports once
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; }~/.cursor/skills-cursor/...~/.claude/skills/....agent/skills/alibabacloud-emas-apm-query/cdcdscripts/list_top_issues.shscripts/dig_issue.shBASH_SOURCE$SKILL_DIRjqrg$SKILL_DIRdigest-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/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)references/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 + RequestIdreferences/verification-method.mdreferences/acceptance-criteria.mdget-issuesModel.Total >= 1DigestHashTotalissues → issue → errors → errorRequestIdErrorCodealiyun configure ai-mode disable
# (optional) delete the local JSON directories produced by dig_issue.sh
rm -rf ./emas-apm-dig-*references/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*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) |