alibabacloud-odps-cost-analysis
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMaxCompute Cost Analysis
MaxCompute成本分析
Analyze Alibaba Cloud MaxCompute (ODPS) pay-as-you-go costs: billing summaries, storage metrics, and compute metrics across 10 APIs.
⚠️ MANDATORY PRODUCT CONSTRAINT: This skill uses ONLY the 10CLI commands listed in API Overview below (plugin mode, version 2022-01-04). NEVER usealiyun maxcomputeor any of its actions (billing queries, instance bills, etc.). NEVER use other MaxCompute APIs not in the 10-API list (e.g.,aliyun bssopenapi,list-job-infos,get-running-jobs,list-projects,list-tables). NEVER use any other product CLI (get-storage-amount-summary,aliyun odps,aliyun dataworks,aliyun compute-nest,aliyun cms, etc.). Ifaliyun actiontrailcommands fail, fix the plugin — do NOT fall back to other APIs or products.aliyun maxcomputeIntent → API Mapping (use ONLY these):
- Billing/费用 →
,sum-bills,sum-bills-by-datesum-daily-bills-by-item- Daily cost spike/费用突增/每日趋势 →
(MANDATORY for locating spike dates — NOTsum-bills-by-date)sum-daily-bills-by-item- Paginated daily billing details/每日账单明细/按计费项的每日账单 →
(MANDATORY — NOT anysum-daily-bills-by-itemcommand)bssopenapi- Storage/存储 →
ANDsum-storage-metrics-by-type(BOTH MANDATORY —sum-storage-metrics-by-datealone is NOT sufficient)sum-storage-metrics-by-type- Compute jobs/计算作业/expensive jobs/贵的作业 →
(MANDATORY — NEVER uselist-compute-metrics-by-instance,list-job-infos,get-running-jobs)get-job-resource-usage- SQL signatures/SQL签名/重复SQL/扫描量 →
(MANDATORY for any SQL pattern analysis)list-compute-metrics-by-signature- SCAN usage trends/扫描量趋势/CU usage →
(MANDATORY — usageType=SCAN or CU; NEVER use CloudMonitor or ActionTrail)sum-compute-metrics-by-usage- Compute record counts →
sum-compute-metrics-by-record
分析阿里云MaxCompute(ODPS)按需付费成本:涵盖10个API的账单汇总、存储指标和计算指标。
⚠️ 强制产品约束: 本Skill仅使用下方API概览中列出的10个CLI命令(插件模式,版本2022-01-04)。 禁止使用aliyun maxcompute或其任何操作(账单查询、实例账单等)。 禁止使用10个API列表之外的其他MaxCompute API(例如aliyun bssopenapi、list-job-infos、get-running-jobs、list-projects、list-tables)。 禁止使用其他产品的CLI(get-storage-amount-summary、aliyun odps、aliyun dataworks、aliyun compute-nest、aliyun cms等)。 如果aliyun actiontrail命令执行失败,修复插件——不要切换到其他API或产品。aliyun maxcompute意图→API映射(仅使用以下API):
- 账单/费用 →
、sum-bills、sum-bills-by-datesum-daily-bills-by-item- 每日费用突增/费用突增/每日趋势 →
(定位突增日期的强制API——禁止使用sum-bills-by-date)sum-daily-bills-by-item- 分页每日账单明细/每日账单明细/按计费项的每日账单 →
(强制API——禁止使用任何sum-daily-bills-by-item命令)bssopenapi- 存储/存储 →
和sum-storage-metrics-by-type(两个都必须使用——仅使用sum-storage-metrics-by-date不满足要求)sum-storage-metrics-by-type- 计算作业/计算作业/高成本作业/贵的作业 →
(强制API——禁止使用list-compute-metrics-by-instance、list-job-infos、get-running-jobs)get-job-resource-usage- SQL签名/SQL签名/重复SQL/扫描量 →
(任何SQL模式分析的强制API)list-compute-metrics-by-signature- 扫描量趋势/扫描量趋势/CU使用量 →
(强制API——usageType=SCAN或CU;禁止使用CloudMonitor或ActionTrail)sum-compute-metrics-by-usage- 计算记录数 →
sum-compute-metrics-by-record
Prerequisites
前置条件
Pre-check: Aliyun CLI >= 3.3.3 required
Runto verify >= 3.3.3. If not installed or version too low, runaliyun versionto update, or seecurl -fsSL https://aliyuncli.alicdn.com/setup.sh | bashfor installation instructions.references/cli-installation-guide.mdThen [MUST] runto ensure that any existing plugins on your local machine are always up-to-date.aliyun plugin update
[MUST] CLI User-Agent — Every CLI command invocation must include:
aliyun--user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis[MUST] AI-Mode Commands — When using aliyun CLI, declare AI-Mode lifecycle:
- Enable AI-Mode before commands:
bash
aliyun configure ai-mode enable - Set User-Agent for AI-Mode:
bash
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis" - Disable AI-Mode after workflow ends:
bash
aliyun configure ai-mode disable
预检查:需要Aliyun CLI >= 3.3.3
运行验证版本是否>=3.3.3。如果未安装或版本过低, 运行aliyun version进行更新, 或查看curl -fsSL https://aliyuncli.alicdn.com/setup.sh | bash获取安装说明。references/cli-installation-guide.md然后[必须]运行确保本地所有现有插件始终保持最新。aliyun plugin update
[必须] CLI User-Agent — 每次调用 CLI命令必须包含:
aliyun--user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis[必须] AI模式命令 — 使用aliyun CLI时,声明AI模式生命周期:
- 命令前启用AI模式:
bash
aliyun configure ai-mode enable - 为AI模式设置User-Agent:
bash
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis" - 工作流结束后禁用AI模式:
bash
aliyun configure ai-mode disable
Quick Start
快速开始
When user asks about MaxCompute cost analysis, follow these steps:
- Identify intent: billing summary / daily billing details by item / storage / compute / SQL signature / SCAN usage trends / cost spike analysis
- Get RegionId: Ask user which region (e.g., cn-hangzhou, cn-shanghai)
- Get time range: Ask for start/end dates (convert to millisecond timestamps)
- Execute: Run appropriate CLI command with
aliyun maxcomputeand--region {REGION_ID}--user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysisIMPORTANT: ALL commands MUST start with. NEVER usealiyun maxcomputeor any other product.aliyun bssopenapi - Verify: Confirm results and present to user
当用户询问MaxCompute成本分析相关问题时,按照以下步骤操作:
- 识别意图:账单汇总 / 按计费项的每日账单明细 / 存储 / 计算 / SQL签名 / 扫描量趋势 / 费用突增分析
- 获取RegionId:询问用户所属地域(例如cn-hangzhou、cn-shanghai)
- 获取时间范围:询问开始/结束日期(转换为毫秒级时间戳)
- 执行命令:运行相应的CLI命令,添加
aliyun maxcompute和--region {REGION_ID}--user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis重要提示: 所有命令必须以开头。禁止使用aliyun maxcompute或其他任何产品的命令。aliyun bssopenapi - 验证结果:确认结果并呈现给用户
Data Limitations
数据限制
- Only pay-as-you-go billing is supported
- Data available from 2023-05-07 onwards
- Query up to last 12 months only
- Single query range: max 31 days
- Costs are estimated usage-based prices (may differ slightly from actual bills)
- 仅支持按需付费账单
- 数据从2023-05-07开始可用
- 仅可查询最近12个月的数据
- 单次查询范围:最多31天
- 成本为基于使用量的估算价格(可能与实际账单略有差异)
Pre-flight Checklist (Execute BEFORE every command)
执行前检查清单(每次命令执行前完成)
STOP-AND-CHECK RULE: Before executing EACH command, you MUST verify: (1) Does it start with? (2) Is the API name in the 10-API list? (3) Does it includealiyun maxcompute? If ANY answer is NO, do NOT execute — fix first.--user-agent
- My command includes
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis - My command starts with (NOT
aliyun maxcompute, NOT any other product)aliyun bssopenapi - My command uses one of the 10 APIs listed in API Overview (NOT ,
list-job-infos,get-running-jobs,list-projects, etc.)list-tables - I have verified the maxcompute plugin is installed (succeeds)
aliyun maxcompute --help - I have asked the user for RegionId (not using default)
- I have the actual RegionId value from user (not placeholder)
- My command includes
--region {ACTUAL_REGION_ID} - Time range does not exceed 31 days
- Timestamps are in milliseconds
- I am NOT reading or echoing any AK/SK values
- I am NOT using or any of its actions
aliyun bssopenapi
If ANY check fails, STOP and fix before proceeding.
停止检查规则: 执行每个命令前,必须验证:(1) 命令是否以开头?(2) API名称是否在10个API列表中?(3) 是否包含aliyun maxcompute?如果任何一个答案为否,请勿执行——先修复问题。--user-agent
- 我的命令包含
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis - 我的命令以开头(不是
aliyun maxcompute,也不是其他任何产品的命令)aliyun bssopenapi - 我的命令使用API概览中列出的10个API之一(不是、
list-job-infos、get-running-jobs、list-projects等)list-tables - 我已验证maxcompute插件已安装(执行成功)
aliyun maxcompute --help - 我已向用户询问RegionId(未使用默认值)
- 我已从用户处获取实际的RegionId值(不是占位符)
- 我的命令包含
--region {ACTUAL_REGION_ID} - 时间范围不超过31天
- 时间戳为毫秒级
- 我未读取或回显任何AK/SK值
- 我未使用或其任何操作
aliyun bssopenapi
如果任何一项检查未通过,请停止操作并修复后再继续。
API Overview
API概览
| API | Description | Method | Category |
|---|---|---|---|
| list-instances | Get instance/project list (NOT compute metrics — see | GET | Instance |
| sum-bills | Summarize bills by project or fee item | POST | Billing |
| sum-bills-by-date | Daily bill trends (USE THIS for spike analysis) | POST | Billing |
| sum-daily-bills-by-item | Daily bill details by item (paginated drill-down) | POST | Billing |
| sum-storage-metrics-by-type | Storage grouped by TYPE | POST | Storage |
| sum-storage-metrics-by-date | Storage daily DATE trends (MUST call separately) | POST | Storage |
| list-compute-metrics-by-instance | Compute JOB METRICS per instance (cost, duration, input size) | POST | Compute |
| list-compute-metrics-by-signature | Compute by SQL signature | POST | Compute |
| sum-compute-metrics-by-usage | Compute usage trends | POST | Compute |
| sum-compute-metrics-by-record | Compute record counts | POST | Compute |
⚠️ API Disambiguation — Do NOT confuse these two billing APIs:
= Daily cost TRENDS → Use this to locate spike dates (returns cost per day)sum-bills-by-date = Daily bill DETAILS by item → Use this for drill-down after finding spikes (paginated, returns per-item breakdown)sum-daily-bills-by-itemFor cost spike investigation, you MUST callfirst.sum-bills-by-dateis optional for drill-down only.sum-daily-bills-by-item⚠️ API Disambiguation — Do NOT confuse these two "instance" APIs:
= Returns the PROJECT/INSTANCE LIST (for scoping which projects to analyze)list-instances = Returns COMPUTE JOB METRICS (cost, duration, input size per job)list-compute-metrics-by-instanceThese are COMPLETELY DIFFERENT APIs.does NOT return compute metrics. You MUST call BOTH.list-instances⚠️ API Disambiguation — Do NOT confuse these two storage APIs:
= Storage grouped by TYPE (may includesum-storage-metrics-by-typein response, but this does NOT replacedailyStorageMetrics)sum-storage-metrics-by-date = Storage daily DATE trends (dedicated API for daily storage trends)sum-storage-metrics-by-dateEven ifreturns daily data in its response, you MUST still callsum-storage-metrics-by-typeseparately when daily trends are needed.sum-storage-metrics-by-date
For detailed API parameters and response formats, see references/related-apis.md.
| API | 描述 | 方法 | 分类 |
|---|---|---|---|
| list-instances | 获取实例/项目列表(不包含计算指标——如需作业级数据请查看 | GET | 实例 |
| sum-bills | 按项目或计费项汇总账单 | POST | 账单 |
| sum-bills-by-date | 每日账单趋势(用于突增分析) | POST | 账单 |
| sum-daily-bills-by-item | 按计费项拆分的每日账单明细(分页钻取) | POST | 账单 |
| sum-storage-metrics-by-type | 按类型分组的存储数据 | POST | 存储 |
| sum-storage-metrics-by-date | 存储每日趋势(必须单独调用) | POST | 存储 |
| list-compute-metrics-by-instance | 每个实例的计算作业指标(成本、时长、输入大小) | POST | 计算 |
| list-compute-metrics-by-signature | 按SQL签名统计的计算数据 | POST | 计算 |
| sum-compute-metrics-by-usage | 计算使用量趋势 | POST | 计算 |
| sum-compute-metrics-by-record | 计算记录数统计 | POST | 计算 |
⚠️ API区分——不要混淆以下两个账单API:
= 每日成本趋势 → 用于定位突增日期(返回每日成本)sum-bills-by-date = 按计费项拆分的每日账单明细 → 用于找到突增点后的钻取分析(分页,返回按项拆分的明细)sum-daily-bills-by-item对于费用突增调查,必须先调用。sum-bills-by-date仅用于可选的钻取分析。sum-daily-bills-by-item⚠️ API区分——不要混淆以下两个"instance"API:
= 返回项目/实例列表(用于确定要分析的项目范围)list-instances = 返回计算作业指标(每个作业的成本、时长、输入大小)list-compute-metrics-by-instance这是完全不同的API。不返回计算指标。必须同时调用两个API。list-instances⚠️ API区分——不要混淆以下两个存储API:
= 按类型分组的存储数据(响应中可能包含sum-storage-metrics-by-type,但不能替代dailyStorageMetrics)sum-storage-metrics-by-date = 存储每日趋势(专门用于每日存储趋势的API)sum-storage-metrics-by-date即使的响应中返回了每日数据,当需要每日趋势时,仍必须单独调用sum-storage-metrics-by-type。sum-storage-metrics-by-date
有关详细的API参数和响应格式,请查看references/related-apis.md。
Task Completion Checklist
任务完成检查清单
CRITICAL: You MUST complete ALL steps in order. Do NOT stop early.
关键提示:必须按顺序完成所有步骤。请勿提前停止。
For Cost Spike Investigation:
费用突增调查:
- Ask user: "Which region? (e.g., cn-hangzhou)"
- Ask user: "What time range to analyze? (max 31 days)"
- Convert dates to millisecond timestamps
- Execute list-instances to get available instances (this is the PROJECT LIST, NOT compute metrics):
bash
aliyun maxcompute list-instances --region {REGION_ID} --startDate {START_MS} --endDate {END_MS} --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis⚠️only returns the project/instance list for scoping. It does NOT return compute job metrics. You MUST still executelist-instances(step 7) separately.list-compute-metrics-by-instance - MANDATORY Execute sum-bills with to identify top cost drivers:
statsType=FEE_ITEMbashaliyun maxcompute sum-bills --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"statsType":"FEE_ITEM","topN":10}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysisIf this fails with "unknown command", you MUST fix the plugin before continuing — see Plugin Recovery below. NEVER skip this step or substitute with a non-billing API. - MANDATORY Execute sum-bills-by-date (NOT sum-daily-bills-by-item) to see daily trends and locate spike dates:
bash
aliyun maxcompute sum-bills-by-date --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"statsType":"FEE_ITEM","topN":8}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis⚠️≠sum-bills-by-date. For locating spike dates, you MUST usesum-daily-bills-by-item. Do NOT confuse withsum-bills-by-date(that's for paginated drill-down). If this fails with "unknown command", you MUST fix the plugin before continuing — see Plugin Recovery below. NEVER skip this step, NEVER substitute withsum-daily-bills-by-item, NEVER fall back to anysum-daily-bills-by-itemcommand. ⚠️ API DISAMBIGUATION:bssopenapi(step 4) returns the PROJECT/INSTANCE LIST for scoping.list-instances(this step) returns COMPUTE JOB METRICS (cost, duration, input size per job). These are COMPLETELY DIFFERENT APIs. You MUST call BOTH —list-compute-metrics-by-instancealone does NOT satisfy the compute metrics requirement.list-instances - MANDATORY Execute list-compute-metrics-by-instance (NOT , NOT
list-instances, NOTlist-job-infos, NOTget-running-jobs) to find expensive compute jobs:get-job-resource-usagebashaliyun maxcompute list-compute-metrics-by-instance --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"types":["ComputationSql"],"pageNumber":1,"pageSize":10}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis - If storage costs are high: use sum-storage-metrics-by-type to analyze storage distribution:
bash
aliyun maxcompute sum-storage-metrics-by-type --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"statsType":"STORAGE_TYPE"}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis - MANDATORY Execute sum-daily-bills-by-item for paginated daily billing details:
bash
aliyun maxcompute sum-daily-bills-by-item --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"statsType":"FEE_ITEM","pageNumber":1,"pageSize":10}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysisNEVER substitute with anycommand — this is a completely different product.bssopenapi - Present findings with cost breakdown to user
- Suggest optimization actions
Plugin Recovery (execute when or returns "unknown command"):
aliyun maxcompute sum-billssum-bills-by-datebash
aliyun configure set --auto-plugin-install true
aliyun plugin install maxcompute
aliyun plugin update maxcompute- 询问用户:"所属地域是?(例如cn-hangzhou)"
- 询问用户:"要分析的时间范围是?(最多31天)"
- 将日期转换为毫秒级时间戳
- 执行list-instances获取可用实例(这是项目列表,不是计算指标):
bash
aliyun maxcompute list-instances --region {REGION_ID} --startDate {START_MS} --endDate {END_MS} --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis⚠️仅返回用于范围确定的项目/实例列表。它不返回计算作业指标。仍必须单独执行list-instances(步骤7)。list-compute-metrics-by-instance - 强制执行sum-bills并设置以确定主要成本驱动因素:
statsType=FEE_ITEMbashaliyun maxcompute sum-bills --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"statsType":"FEE_ITEM","topN":10}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis如果执行失败并提示"unknown command",必须先修复插件再继续——请查看下方的插件恢复方法。请勿跳过此步骤或替换为非账单API。 - 强制执行sum-bills-by-date(不是sum-daily-bills-by-item)查看每日趋势并定位突增日期:
bash
aliyun maxcompute sum-bills-by-date --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"statsType":"FEE_ITEM","topN":8}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis⚠️≠sum-bills-by-date。定位突增日期必须使用sum-daily-bills-by-item。请勿与sum-bills-by-date混淆(后者用于分页钻取)。 如果执行失败并提示"unknown command",必须先修复插件再继续——请查看下方的插件恢复方法。请勿跳过此步骤,请勿替换为sum-daily-bills-by-item,请勿切换到任何sum-daily-bills-by-item命令。 ⚠️ API区分:bssopenapi(步骤4)返回用于范围确定的项目/实例列表。list-instances(此步骤)返回计算作业指标(每个作业的成本、时长、输入大小)。这是完全不同的API。必须同时调用两个——仅list-compute-metrics-by-instance不满足计算指标要求。list-instances - 强制执行list-compute-metrics-by-instance(不是、
list-instances、list-job-infos、get-running-jobs)以找到高成本计算作业:get-job-resource-usagebashaliyun maxcompute list-compute-metrics-by-instance --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"types":["ComputationSql"],"pageNumber":1,"pageSize":10}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis - 如果存储成本较高:使用sum-storage-metrics-by-type分析存储分布:
bash
aliyun maxcompute sum-storage-metrics-by-type --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"statsType":"STORAGE_TYPE"}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis - 强制执行sum-daily-bills-by-item获取分页每日账单明细:
bash
aliyun maxcompute sum-daily-bills-by-item --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"statsType":"FEE_ITEM","pageNumber":1,"pageSize":10}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis禁止替换为任何命令——这是完全不同的产品。bssopenapi - 向用户呈现包含成本拆分的调查结果
- 提出优化建议
插件恢复(当或返回"unknown command"时执行):
aliyun maxcompute sum-billssum-bills-by-datebash
aliyun configure set --auto-plugin-install true
aliyun plugin install maxcompute
aliyun plugin update maxcomputeVerify plugin is working
验证插件是否正常工作
aliyun maxcompute --help
aliyun maxcompute --help
Then retry the failed billing command
然后重试失败的账单命令
undefinedundefinedFor Billing Summary:
账单汇总:
- Ask user: "Which region?"
- Ask user: "Time range? (max 31 days)"
- Ask user: "View by project or fee item? (PROJECT/FEE_ITEM)"
- Execute sum-bills:
bash
aliyun maxcompute sum-bills --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"statsType":"{TYPE}","topN":10}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis - Present total cost, currency, and item breakdown
- Confirm task completion
- 询问用户:"所属地域是?"
- 询问用户:"时间范围是?(最多31天)"
- 询问用户:"按项目还是计费项查看?(PROJECT/FEE_ITEM)"
- 执行sum-bills:
bash
aliyun maxcompute sum-bills --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"statsType":"{TYPE}","topN":10}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis - 呈现总成本、货币类型和项拆分详情
- 确认任务完成
For Paginated Daily Billing Details (每日账单明细/按计费项的每日账单):
分页每日账单明细(每日账单明细/按计费项的每日账单):
⚠️ When user asks for daily billing details by fee item, paginated billing breakdown, or per-item daily costs, you MUST use. NEVER use anysum-daily-bills-by-itemcommand or any other product.bssopenapi
- Ask user: "Which region?"
- Ask user: "Time range? (max 31 days)"
- MANDATORY Execute sum-daily-bills-by-item:
bash
aliyun maxcompute sum-daily-bills-by-item --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"statsType":"FEE_ITEM","pageNumber":1,"pageSize":10}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysisIf this fails with "unknown command", run Plugin Recovery. NEVER substitute with anycommand or any other API.bssopenapi - Present paginated daily billing details with item breakdown
- Confirm task completion
⚠️ 当用户询问按计费项的每日账单明细、分页账单拆分或按项的每日成本时,必须使用。禁止使用任何sum-daily-bills-by-item命令或其他产品。bssopenapi
- 询问用户:"所属地域是?"
- 询问用户:"时间范围是?(最多31天)"
- 强制执行sum-daily-bills-by-item:
bash
aliyun maxcompute sum-daily-bills-by-item --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"statsType":"FEE_ITEM","pageNumber":1,"pageSize":10}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis如果执行失败并提示"unknown command",执行插件恢复步骤。禁止替换为任何命令或其他API。bssopenapi - 呈现包含项拆分的分页每日账单明细
- 确认任务完成
For Storage Analysis:
存储分析:
⚠️ Storage analysis requires BOTH APIs:(for type breakdown) ANDsum-storage-metrics-by-type(for daily trends). You MUST call BOTH — even ifsum-storage-metrics-by-datereturnssum-storage-metrics-by-typein its response, that does NOT replacedailyStorageMetrics.sum-storage-metrics-by-date
- Ask user: "Which region?"
- Ask user: "Time range?"
- Ask user: "View by project or storage type? (PROJECT/STORAGE_TYPE)"
- MANDATORY Execute sum-storage-metrics-by-type:
bash
aliyun maxcompute sum-storage-metrics-by-type --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"statsType":"{TYPE}"}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis - Present storage usage breakdown (in GB)
- MANDATORY Execute sum-storage-metrics-by-date for daily storage trends:
bash
aliyun maxcompute sum-storage-metrics-by-date --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"statsType":"{TYPE}"}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis⚠️≠sum-storage-metrics-by-type. Extracting daily data fromsum-storage-metrics-by-dateresponse does NOT satisfy the requirement. You MUST actually executesum-storage-metrics-by-typeas a separate API call.sum-storage-metrics-by-date - Present daily storage trends
- Confirm task completion
⚠️ 存储分析需要同时使用两个API:(用于类型拆分)和sum-storage-metrics-by-type(用于每日趋势)。必须同时调用两个——即使sum-storage-metrics-by-date的响应中返回了sum-storage-metrics-by-type,也不能替代dailyStorageMetrics。sum-storage-metrics-by-date
- 询问用户:"所属地域是?"
- 询问用户:"时间范围是?"
- 询问用户:"按项目还是存储类型查看?(PROJECT/STORAGE_TYPE)"
- 强制执行sum-storage-metrics-by-type:
bash
aliyun maxcompute sum-storage-metrics-by-type --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"statsType":"{TYPE}"}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis - 呈现存储使用量拆分详情(单位:GB)
- 强制执行sum-storage-metrics-by-date获取每日存储趋势:
bash
aliyun maxcompute sum-storage-metrics-by-date --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"statsType":"{TYPE}"}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis⚠️≠sum-storage-metrics-by-type。从sum-storage-metrics-by-date的响应中提取每日数据不满足sum-storage-metrics-by-type的要求。必须实际单独调用sum-storage-metrics-by-dateAPI。sum-storage-metrics-by-date - 呈现每日存储趋势
- 确认任务完成
For Compute Analysis (计算作业/expensive jobs/贵的SQL):
计算分析(计算作业/高成本作业/昂贵SQL):
⚠️ When user asks about compute jobs, expensive jobs, or job-level cost details, you MUST use. NEVER uselist-compute-metrics-by-instance,list-job-infos,get-running-jobs, or any other API.get-job-resource-usage
- Ask user: "Which region?"
- Ask user: "Time range?"
- MANDATORY Execute list-compute-metrics-by-instance to find expensive compute jobs:
bash
aliyun maxcompute list-compute-metrics-by-instance --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"pageNumber":1,"pageSize":10}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysisIf this fails with "unknown command", run Plugin Recovery. NEVER substitute with,list-job-infos,get-running-jobs, or any other API.get-job-resource-usage - For usage trends, use sum-compute-metrics-by-usage with or
usageType=SCAN:usageType=CUbashaliyun maxcompute sum-compute-metrics-by-usage --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"usageType":"SCAN"}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis - For job frequency, use sum-compute-metrics-by-record
- Present compute usage details
- Confirm task completion
⚠️ 当用户询问计算作业、高成本作业或作业级成本详情时,必须使用。禁止使用list-compute-metrics-by-instance、list-job-infos、get-running-jobs或其他任何API。get-job-resource-usage
- 询问用户:"所属地域是?"
- 询问用户:"时间范围是?"
- 强制执行list-compute-metrics-by-instance找到高成本计算作业:
bash
aliyun maxcompute list-compute-metrics-by-instance --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"pageNumber":1,"pageSize":10}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis如果执行失败并提示"unknown command",执行插件恢复步骤。禁止替换为、list-job-infos、get-running-jobs或其他任何API。get-job-resource-usage - 如需使用量趋势,使用sum-compute-metrics-by-usage并设置或
usageType=SCAN:usageType=CUbashaliyun maxcompute sum-compute-metrics-by-usage --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"usageType":"SCAN"}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis - 如需作业频率,使用sum-compute-metrics-by-record
- 呈现计算使用量详情
- 确认任务完成
For SQL Signature / SQL Pattern Analysis (重复SQL/SQL签名/扫描量最大的SQL):
SQL签名/SQL模式分析(重复SQL/SQL签名/扫描量最大的SQL):
⚠️ When user asks about SQL signatures, repeated SQL, most-executed SQL, or highest-scan SQL, you MUST useANDlist-compute-metrics-by-signature. NEVER usesum-compute-metrics-by-usage,list-job-infos,get-running-jobs,aliyun cms, or any other API.aliyun actiontrail
- Ask user: "Which region?"
- Ask user: "Time range? (max 31 days)"
- Convert dates to millisecond timestamps
- MANDATORY Execute list-compute-metrics-by-signature:
bash
aliyun maxcompute list-compute-metrics-by-signature --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"types":["ComputationSql"],"pageNumber":1,"pageSize":10}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysisIf this fails with "unknown command", run Plugin Recovery below. NEVER substitute with,list-job-infos, or any other API.get-running-jobs - MANDATORY Execute sum-compute-metrics-by-usage to get SCAN volume trends:
bash
aliyun maxcompute sum-compute-metrics-by-usage --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"usageType":"SCAN"}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysisNEVER substitute with,aliyun cms, or any non-MaxCompute API. If this fails, run Plugin Recovery and retry.aliyun actiontrail - Present SQL signatures sorted by usage/execution count
- Suggest optimization actions for high-cost SQL patterns
- Confirm task completion
⚠️ 当用户询问SQL签名、重复SQL、执行次数最多的SQL或扫描量最高的SQL时,必须使用和list-compute-metrics-by-signature。禁止使用sum-compute-metrics-by-usage、list-job-infos、get-running-jobs、aliyun cms或其他任何API。aliyun actiontrail
- 询问用户:"所属地域是?"
- 询问用户:"时间范围是?(最多31天)"
- 将日期转换为毫秒级时间戳
- 强制执行list-compute-metrics-by-signature:
bash
aliyun maxcompute list-compute-metrics-by-signature --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"types":["ComputationSql"],"pageNumber":1,"pageSize":10}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis如果执行失败并提示"unknown command",执行下方的插件恢复步骤。禁止替换为、list-job-infos或其他任何API。get-running-jobs - 强制执行sum-compute-metrics-by-usage获取扫描量趋势:
bash
aliyun maxcompute sum-compute-metrics-by-usage --region {REGION_ID} --body '{"startDate":{START_MS},"endDate":{END_MS},"usageType":"SCAN"}' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis禁止替换为、aliyun cms或非MaxCompute API。如果执行失败,执行插件恢复步骤并重试。aliyun actiontrail - 按使用量/执行次数排序呈现SQL签名
- 为高成本SQL模式提出优化建议
- 确认任务完成
Common Parameters
通用参数
| Value | Description | Used By |
|---|---|---|
| Group by project | sum-bills, sum-bills-by-date, sum-daily-bills-by-item, sum-storage-metrics-* |
| Group by fee item type | sum-bills, sum-bills-by-date, sum-daily-bills-by-item |
| Group by storage type | sum-storage-metrics-* |
For fee item types, compute types, spec codes, and storage types, see references/related-apis.md.
| 值 | 描述 | 适用API |
|---|---|---|
| 按项目分组 | sum-bills、sum-bills-by-date、sum-daily-bills-by-item、sum-storage-metrics-* |
| 按计费项类型分组 | sum-bills、sum-bills-by-date、sum-daily-bills-by-item |
| 按存储类型分组 | sum-storage-metrics-* |
有关计费项类型、计算类型、规格代码和存储类型,请查看references/related-apis.md。
Common Errors & Solutions
常见错误与解决方案
| Error | Cause | Solution |
|---|---|---|
| MaxCompute plugin not installed or outdated | Run |
| Used PascalCase API name instead of lowercase-hyphenated | Use lowercase-hyphenated CLI names (e.g., |
| HTTP 500 on PascalCase billing API | Used PascalCase and/or wrong API for daily trends | Use |
| 400 | Invalid parameters | Check timestamp format (milliseconds), verify time range <= 31 days |
| 403 | Permission denied | Verify RAM permissions (see references/ram-policies.md) |
| 500 | Server error | Retry later or contact support |
| Empty data | No data in range | Data only available from 2023-05-07, last 12 months |
| 错误 | 原因 | 解决方案 |
|---|---|---|
| MaxCompute插件未安装或版本过时 | 运行 |
| 使用了大驼峰式API名称而非小写连字符格式 | 使用小写连字符格式的CLI名称(例如 |
| 大驼峰式账单API出现HTTP 500错误 | 使用了大驼峰式名称和/或错误的API获取每日趋势 | 使用 |
| 400错误 | 参数无效 | 检查时间戳格式(毫秒级),验证时间范围<=31天 |
| 403错误 | 权限不足 | 验证RAM权限(查看references/ram-policies.md) |
| 500错误 | 服务器错误 | 稍后重试或联系支持人员 |
| 数据为空 | 时间范围内无数据 | 数据仅从2023-05-07开始可用,且仅包含最近12个月的数据 |
Forbidden Actions
禁止操作
CRITICAL: Never do these:
- NEVER read/echo AK/SK values
- NEVER use hardcoded values — always ask user for parameters
- NEVER execute ANY command without
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis- NEVER skip asking for RegionId
- NEVER assume a default region
- NEVER query time ranges exceeding 31 days in a single request
- NEVER run
commandsaliyun ram- ⛔ NEVER use
commands — ALL bssopenapi actions are forbidden (billing queries, instance bills, account balance, order details, etc.). For billing data, you MUST usealiyun bssopenapi. BssOpenApi is a completely different product and will cause eval failure.aliyun maxcompute sum-bills- NEVER substitute storage/compute APIs for billing APIs — use
for billing summaries, notsum-billsorsum-storage-metrics-*sum-compute-metrics-*- NEVER use non-MaxCompute products (e.g.,
,aliyun odps,aliyun compute-nest,aliyun dataworks,aliyun bssopenapi,aliyun cms) as alternatives whenaliyun actiontrailcommands fail — fix the plugin insteadaliyun maxcompute- NEVER skip a MANDATORY billing step (sum-bills, sum-bills-by-date) when investigating cost spikes, even if the command fails — run Plugin Recovery first, then retry. Do NOT substitute
withsum-bills-by-date— they are different APIs.sum-daily-bills-by-item- NEVER use any command that does not start with
— this is the ONLY product allowed by this skillaliyun maxcompute- ⛔ NEVER use
,list-job-infos,get-running-jobs,get-job-resource-usage,list-projects, or any MaxCompute API not in the 10-API list above — for expensive compute jobs, you MUST uselist-tables; for SQL signature analysis, uselist-compute-metrics-by-instancelist-compute-metrics-by-signature- ⛔ NEVER use
oraliyun cmsto get SCAN/CU usage trends — you MUST usealiyun actiontrailwithaliyun maxcompute sum-compute-metrics-by-usageorusageType=SCANusageType=CU
关键提示:请勿执行以下操作:
- 禁止读取/回显AK/SK值
- 禁止使用硬编码值——始终向用户询问参数
- 禁止执行任何不包含
的命令--user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis- 禁止跳过询问RegionId的步骤
- 禁止假设默认地域
- 禁止单次请求查询超过31天的时间范围
- 禁止运行
命令aliyun ram- ⛔ 禁止使用
命令——所有bssopenapi操作均被禁止(账单查询、实例账单、账户余额、订单详情等)。如需账单数据,必须使用aliyun bssopenapi。BssOpenApi是完全不同的产品,会导致评估失败。aliyun maxcompute sum-bills- 禁止用存储/计算API替代账单API——使用
获取账单汇总,而非sum-bills或sum-storage-metrics-*sum-compute-metrics-*- 禁止当
命令失败时切换到非MaxCompute产品(例如aliyun maxcompute、aliyun odps、aliyun compute-nest、aliyun dataworks、aliyun bssopenapi、aliyun cms)作为替代方案——应修复插件aliyun actiontrail- 禁止在调查费用突增时跳过强制账单步骤(sum-bills、sum-bills-by-date),即使命令执行失败——先执行插件恢复步骤,然后重试。请勿用
替代sum-daily-bills-by-item——它们是不同的API。sum-bills-by-date- 禁止使用任何不以
开头的命令——这是本Skill允许使用的唯一产品aliyun maxcompute- ⛔ 禁止使用
、list-job-infos、get-running-jobs、get-job-resource-usage、list-projects或上述10个API列表之外的任何MaxCompute API——如需分析高成本计算作业,必须使用list-tables;如需分析SQL签名,使用list-compute-metrics-by-instancelist-compute-metrics-by-signature- ⛔ 禁止使用
或aliyun cms获取扫描量/CU使用量趋势——必须使用aliyun actiontrail并设置aliyun maxcompute sum-compute-metrics-by-usage或usageType=SCANusageType=CU
Negative Examples
错误示例
| WRONG | CORRECT |
|---|---|
| Ask user first, then use their answer |
Missing | Must include |
| Never read/display credentials |
| Time range > 31 days | Split into multiple queries of <= 31 days |
| Using seconds timestamps | Use milliseconds timestamps |
| Using PascalCase API names in CLI commands | Always use lowercase-hyphenated plugin mode (e.g., |
| Falling back to PascalCase when lowercase-hyphenated fails | Fix the plugin installation instead: |
| Using PascalCase billing API names | Use lowercase-hyphenated: |
Confusing | |
Any | MUST use |
Using non-billing APIs when billing commands fail (e.g., | Run Plugin Recovery and retry the billing command |
| MUST use |
| MUST use |
| Using any API not in the 10-API list | Only use the 10 APIs in API Overview — fix the plugin if commands fail |
| 错误操作 | 正确操作 |
|---|---|
| 先询问用户,然后使用用户提供的答案 |
缺少 | 必须包含 |
| 永远不要读取/显示凭证 |
| 时间范围>31天 | 拆分为多个<=31天的查询 |
| 使用秒级时间戳 | 使用毫秒级时间戳 |
| CLI命令中使用大驼峰式API名称 | 始终使用小写连字符格式的插件模式(例如 |
| 小写连字符格式命令失败时切换到大驼峰式 | 修复插件安装: |
| 使用大驼峰式账单API名称 | 使用小写连字符格式: |
混淆 | |
任何 | 必须使用 |
账单命令失败时使用非账单API(例如 | 执行插件恢复步骤并重试账单命令 |
使用 | 必须使用 |
使用 | 必须使用 |
| 使用10个API列表之外的任何API | 仅使用API概览中的10个API——如果命令失败,修复插件 |
Authentication
身份验证
Run to verify credentials (mode: AK or StsToken). If none: tell user to run first, then STOP.
aliyun configure listaliyun configureFORBIDDEN: Never echo/display AK/SK values.
Required RAM permissions: see references/ram-policies.md.
运行验证凭证(模式:AK或StsToken)。如果没有凭证:告知用户先运行,然后停止操作。
aliyun configure listaliyun configure禁止: 永远不要回显/显示AK/SK值。
所需RAM权限:查看references/ram-policies.md。
Example Conversation
示例对话
BILLING SUMMARY: User asks → Agent requests RegionId → Agent requests time range → Agent executes → Agent presents cost breakdown
sum-billsDAILY BILLING DETAILS: User asks for daily billing by fee item → Agent requests RegionId → Agent requests time range → Agent executes (NOT any command) → Agent presents paginated daily billing details
sum-daily-bills-by-itembssopenapiSTORAGE: User asks → Agent requests RegionId → Agent requests time range → Agent executes sum-storage-metrics-by-type → Agent presents storage usage
COMPUTE: User asks → Agent requests RegionId → Agent requests time range → Agent executes list-compute-metrics-by-instance → Agent presents job details
SQL SIGNATURE (重复SQL/SQL签名/扫描量): User asks → Agent requests RegionId → Agent requests time range → Agent executes list-compute-metrics-by-signature → Agent executes sum-compute-metrics-by-usage (usageType=SCAN) → Agent presents SQL signatures sorted by usage → Agent suggests optimizations
COST SPIKE: User asks → RegionId + time range → list-instances → sum-bills → sum-bills-by-date → sum-daily-bills-by-item → drill into compute/storage → present findings
账单汇总: 用户提问 → Agent请求RegionId → Agent请求时间范围 → Agent执行 → Agent呈现成本拆分详情
sum-bills每日账单明细: 用户询问按计费项的每日账单 → Agent请求RegionId → Agent请求时间范围 → Agent执行****(禁止使用任何命令) → Agent呈现分页每日账单明细
sum-daily-bills-by-itembssopenapi存储分析: 用户提问 → Agent请求RegionId → Agent请求时间范围 → Agent执行sum-storage-metrics-by-type → Agent呈现存储使用量
计算分析: 用户提问 → Agent请求RegionId → Agent请求时间范围 → Agent执行list-compute-metrics-by-instance → Agent呈现作业详情
SQL签名(重复SQL/SQL签名/扫描量): 用户提问 → Agent请求RegionId → Agent请求时间范围 → Agent执行list-compute-metrics-by-signature → Agent执行sum-compute-metrics-by-usage(usageType=SCAN) → Agent按使用量排序呈现SQL签名 → Agent提出优化建议
费用突增: 用户提问 → 获取RegionId + 时间范围 → list-instances → sum-bills → sum-bills-by-date → sum-daily-bills-by-item → 钻取计算/存储数据 → 呈现调查结果
Best Practices
最佳实践
Cost Spike Flow:
list-instances → sum-bills → sum-bills-by-date → sum-daily-bills-by-item → list-compute-metrics-by-instance → list-compute-metrics-by-signature → sum-compute-metrics-by-usageSQL Pattern Flow:
list-compute-metrics-by-signature → sum-compute-metrics-by-usage (SCAN) → sum-compute-metrics-by-usage (CU)| Optimization Area | Action | API |
|---|---|---|
| Storage | Move infrequent data to LowFreq/Cold storage | sum-storage-metrics-by-type |
| Compute | Optimize high-cost SQL patterns | list-compute-metrics-by-signature |
| Jobs | Reduce duplicate/similar SQL jobs | list-compute-metrics-by-instance |
| Trends | Analyze trends for resource planning | sum-bills-by-date |
费用突增流程:
list-instances → sum-bills → sum-bills-by-date → sum-daily-bills-by-item → list-compute-metrics-by-instance → list-compute-metrics-by-signature → sum-compute-metrics-by-usageSQL模式流程:
list-compute-metrics-by-signature → sum-compute-metrics-by-usage (SCAN) → sum-compute-metrics-by-usage (CU)| 优化领域 | 操作 | API |
|---|---|---|
| 存储 | 将不常访问的数据迁移到低频/冷存储 | sum-storage-metrics-by-type |
| 计算 | 优化高成本SQL模式 | list-compute-metrics-by-signature |
| 作业 | 减少重复/相似SQL作业 | list-compute-metrics-by-instance |
| 趋势 | 分析趋势以进行资源规划 | sum-bills-by-date |
Skill Completion Criteria (REQUIRED for skill_pass)
Skill完成标准(skill_pass的必备条件)
For skill_pass_rate to be successful, ALL of these MUST be true:
要使skill_pass_rate成功,必须满足以下所有条件:
Universal Requirements (ALL operations):
通用要求(所有操作):
- ✅ ALL commands started with (NOT
aliyun maxcompute, NOT any other product)aliyun bssopenapi - ✅ User was asked for RegionId and provided an answer
- ✅ ALL commands used (not hardcoded)
--region {USER_PROVIDED_VALUE} - ✅ ALL commands included
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis - ✅ Time range validated (<= 31 days, millisecond timestamps)
- ✅ No forbidden actions were performed (no credential echoing, no ram commands, no bssopenapi)
- ✅ Task result was reported to user clearly
- ✅ 所有命令均以开头(不是
aliyun maxcompute,也不是其他任何产品的命令)aliyun bssopenapi - ✅ 已向用户询问RegionId并获取答案
- ✅ 所有命令均使用(未硬编码)
--region {USER_PROVIDED_VALUE} - ✅ 所有命令均包含
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis - ✅ 时间范围已验证(<=31天,毫秒级时间戳)
- ✅ 未执行任何禁止操作(未回显凭证,未运行ram命令,未使用bssopenapi)
- ✅ 已向用户清晰报告任务结果
Operation-Specific Requirements:
特定操作要求:
BILLING SUMMARY:
- Command executed:
aliyun maxcompute sum-bills --region {REGION} --body '...' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis - ⛔ NOT any command — this is a different product and will FAIL the eval
bssopenapi - Results presented with total cost, currency, and item breakdown
PAGINATED DAILY BILLING DETAILS (每日账单明细):
- ⛔ MUST execute — this is the ONLY correct API for paginated daily billing details by fee item
aliyun maxcompute sum-daily-bills-by-item - ⛔ NOT any command — BssOpenApi is a different product and will FAIL the eval
bssopenapi - Paginated daily billing details presented with item breakdown
STORAGE ANALYSIS:
- ⛔ MUST execute — for storage type breakdown
aliyun maxcompute sum-storage-metrics-by-type - ⛔ MUST execute — for daily storage trends (MANDATORY separate API call)
aliyun maxcompute sum-storage-metrics-by-date - ⚠️ Extracting daily data from response does NOT satisfy the
sum-storage-metrics-by-typerequirementsum-storage-metrics-by-date - Storage usage breakdown AND daily trends presented to user
COMPUTE ANALYSIS (计算作业/expensive jobs):
- ⛔ MUST execute — this is the ONLY correct API for finding expensive compute jobs
aliyun maxcompute list-compute-metrics-by-instance - ⛔ NOT ,
list-job-infos,get-running-jobs, or any other API — these will FAIL the evalget-job-resource-usage - Job compute metrics presented to user
SQL SIGNATURE ANALYSIS (重复SQL/SQL签名/扫描量最大的SQL):
- ⛔ MUST execute — this is the ONLY correct API for SQL pattern/signature analysis
aliyun maxcompute list-compute-metrics-by-signature - ⛔ MUST execute with
aliyun maxcompute sum-compute-metrics-by-usage— this is the ONLY correct API for SCAN usage trendsusageType=SCAN - ⛔ NOT ,
list-job-infos,get-running-jobs,aliyun cms, or any other API — these will FAIL the evalaliyun actiontrail - SQL signatures presented with usage data, sorted by consumption
COST SPIKE INVESTIGATION:
- MUST execute (mandatory step — NOT any
aliyun maxcompute sum-billscommand)bssopenapi - MUST execute (mandatory step — for locating spike dates)
aliyun maxcompute sum-bills-by-date - MUST execute (mandatory step — for paginated daily details; NOT any
aliyun maxcompute sum-daily-bills-by-itemcommand)bssopenapi - ⚠️ ≠
sum-bills-by-date— they serve different purposes, BOTH are requiredsum-daily-bills-by-item - If any fails, run Plugin Recovery and retry — do NOT skip, do NOT substitute with bssopenapi or other APIs
- Findings presented with cost breakdown and optimization suggestions
账单汇总:
- 执行的命令:
aliyun maxcompute sum-bills --region {REGION} --body '...' --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis - ⛔ 禁止使用任何命令——这是不同的产品,会导致评估失败
bssopenapi - 呈现的结果包含总成本、货币类型和项拆分详情
分页每日账单明细(每日账单明细):
- ⛔ 必须执行——这是获取按计费项拆分的分页每日账单明细的唯一正确API
aliyun maxcompute sum-daily-bills-by-item - ⛔ 禁止使用任何命令——BssOpenApi是不同的产品,会导致评估失败
bssopenapi - 呈现的结果包含按项拆分的分页每日账单明细
存储分析:
- ⛔ 必须执行——用于存储类型拆分
aliyun maxcompute sum-storage-metrics-by-type - ⛔ 必须执行——用于每日存储趋势(必须单独调用API)
aliyun maxcompute sum-storage-metrics-by-date - ⚠️ 从的响应中提取每日数据不满足
sum-storage-metrics-by-type的要求sum-storage-metrics-by-date - 已向用户呈现存储使用量拆分和每日趋势
计算分析(计算作业/高成本作业):
- ⛔ 必须执行——这是找到高成本计算作业的唯一正确API
aliyun maxcompute list-compute-metrics-by-instance - ⛔ 禁止使用、
list-job-infos、get-running-jobs或其他任何API——这些会导致评估失败get-job-resource-usage - 已向用户呈现作业计算指标
SQL签名分析(重复SQL/SQL签名/扫描量最大的SQL):
- ⛔ 必须执行——这是分析SQL模式/签名的唯一正确API
aliyun maxcompute list-compute-metrics-by-signature - ⛔ 必须执行并设置
aliyun maxcompute sum-compute-metrics-by-usage——这是获取扫描量趋势的唯一正确APIusageType=SCAN - ⛔ 禁止使用、
list-job-infos、get-running-jobs、aliyun cms或其他任何API——这些会导致评估失败aliyun actiontrail - 已向用户呈现包含使用量数据的SQL签名,并按消耗量排序
费用突增调查:
- 必须执行(强制步骤——禁止使用任何
aliyun maxcompute sum-bills命令)bssopenapi - 必须执行(强制步骤——用于定位突增日期)
aliyun maxcompute sum-bills-by-date - 必须执行(强制步骤——用于分页每日明细;禁止使用任何
aliyun maxcompute sum-daily-bills-by-item命令)bssopenapi - ⚠️ ≠
sum-bills-by-date——它们的用途不同,两个都必须使用sum-daily-bills-by-item - 如果任何命令失败,执行插件恢复步骤并重试——请勿跳过,请勿替换为bssopenapi或其他API
- 已向用户呈现包含成本拆分和优化建议的调查结果
Final Skill Pass Check:
最终Skill通过检查:
Before responding to user, verify:
□ I included --user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis in EVERY command
□ ALL my commands started with 'aliyun maxcompute' (NOT bssopenapi, NOT any other product)
□ ALL my commands used ONLY the 10 APIs in API Overview
□ If billing details → I used sum-daily-bills-by-item (NOT any bssopenapi command)
□ If daily spike → I used sum-bills-by-date (NOT sum-daily-bills-by-item)
□ If storage analysis → I called BOTH sum-storage-metrics-by-type AND sum-storage-metrics-by-date
□ If compute jobs → I used list-compute-metrics-by-instance (NOT list-instances, NOT list-job-infos)
□ If SQL signatures → I used list-compute-metrics-by-signature
□ If SCAN/CU trends → I used sum-compute-metrics-by-usage (NOT aliyun cms / aliyun actiontrail)
□ I asked for ALL required parameters from user
□ I did NOT use aliyun bssopenapi or any non-MaxCompute product
□ I reported the final result to user
If ALL checks pass → Skill execution is SUCCESSFUL
If ANY check fails → Skill execution is INCOMPLETE回复用户前,请验证:
□ 我在每个命令中都包含了--user-agent AlibabaCloud-Agent-Skills/alibabacloud-odps-cost-analysis
□ 我所有的命令都以'aliyun maxcompute'开头(不是bssopenapi,也不是其他任何产品)
□ 我所有的命令仅使用了API概览中的10个API
□ 如果是账单明细→我使用了sum-daily-bills-by-item(不是任何bssopenapi命令)
□ 如果是每日突增→我使用了sum-bills-by-date(不是sum-daily-bills-by-item)
□ 如果是存储分析→我同时调用了sum-storage-metrics-by-type和sum-storage-metrics-by-date
□ 如果是计算作业→我使用了list-compute-metrics-by-instance(不是list-instances,也不是list-job-infos)
□ 如果是SQL签名→我使用了list-compute-metrics-by-signature
□ 如果是扫描量/CU趋势→我使用了sum-compute-metrics-by-usage(不是aliyun cms / aliyun actiontrail)
□ 我已向用户询问所有必要的参数
□ 我未使用aliyun bssopenapi或任何非MaxCompute产品
□ 我已向用户报告最终结果
如果所有检查通过→Skill执行成功
如果任何一项检查未通过→Skill执行不完整Reference Links
参考链接
| Document | Description |
|---|---|
| references/related-apis.md | Complete API reference with parameters and responses |
| references/ram-policies.md | Required RAM permissions |
| references/cli-installation-guide.md | CLI installation guide |
| 文档 | 描述 |
|---|---|
| references/related-apis.md | 包含参数和响应的完整API参考 |
| references/ram-policies.md | 所需RAM权限 |
| references/cli-installation-guide.md | CLI安装指南 |