Skip to main content

cost-optimizer

Recommend Databricks cost-optimization actions for the FinOps/platform team — commitment/discount coverage, budget variance, and forecast-vs-actual DBU spend from system.billing.usage and system.billing.list_prices.

跳到安装

来源信息

仓库
databricks-solutions/ai-governance
最近来源活动
2026年9月2日 16:08
检测到的 SKILL.md 语言
英语
星标
2
分支
2

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
2 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
cost-optimizer
description
Recommend Databricks cost-optimization actions for the FinOps/platform team — commitment/discount coverage, budget variance, and forecast-vs-actual DBU spend from system.billing.usage and system.billing.list_prices.
> **Illustrative example** — demonstrates a well-formed `SKILL.md` for this reference > implementation. Adapt the content to your own org; do not deploy verbatim. # cost-optimizer ## Overview Turns Databricks billing data into finance-facing optimization actions: it measures commitment/discount coverage, compares actual spend against budget, and forecasts month-end DBU cost so the FinOps/platform team can act before overruns land. Distinct from `pipeline-cost-analyzer` (which is engineering-facing job/SKU analysis) — this skill is scoped to budget governance and dollarized recommendations. ## When to use this skill When a finance user asks about budget adherence, discount coverage, or spend forecasting: - "Are we on track against this month's Databricks budget?" - "What share of our DBUs are covered by our committed-use discount?" - "Project our month-end spend at the current run rate." - "Where is spend running over budget by product?" ## Instructions 1. **Establish the budget baseline** — ask for the monthly budget if not supplied; otherwise compare against the trailing 3-month average as an implicit baseline. 2. **Dollarize usage** — join `system.billing.usage` to `system.billing.list_prices` to convert DBUs to cost; never present raw DBUs alone to a finance audience. 3. **Assess coverage and variance** — compute committed-discount coverage and budget variance. 4. **Forecast** — extrapolate month-to-date run rate to a month-end projection. 5. **Recommend** — give 2–3 dollar-quantified actions, ordered by savings impact. ## Examples ### Month-end spend forecast at current run rate ```sql WITH mtd AS ( SELECT SUM(u.usage_quantity * p.pricing.default) AS cost_to_date, DAY(CURRENT_DATE()) AS days_elapsed, DAY(LAST_DAY(CURRENT_DATE())) AS days_in_month FROM system.billing.usage u JOIN system.billing.list_prices p ON u.sku_name = p.sku_name WHERE u.usage_date >= DATE_TRUNC('month', CURRENT_DATE()) ) SELECT cost_to_date, ROUND(cost_to_date / days_elapsed * days_in_month, 2) AS projected_month_end FROM mtd ``` ### Spend by product vs. trailing average (budget-variance signal) ```sql SELECT billing_origin_product, SUM(usage_quantity) AS dbus_this_month FROM system.billing.usage WHERE usage_date >= DATE_TRUNC('month', CURRENT_DATE()) GROUP BY 1 ORDER BY dbus_this_month DESC ``` ## Recommendations framework Every response ends with dollar-quantified actions: 1. **Biggest variance** — the product/workspace most over baseline, with an estimated monthly-dollar impact and one corrective action. 2. **Coverage gap** — uncommitted spend that a committed-use discount would cover, with the estimated discount saving. 3. **Quick win** — one action realizable this billing cycle (e.g. move a recurring batch job off all-purpose compute). ## Edge cases - **Missing budget** — if no budget is provided, state the baseline you used (trailing 3-month average) so the variance is interpretable. - **Early in the month** — a run-rate forecast on <5 elapsed days is noisy; flag the low confidence rather than presenting a point estimate as firm. - **Price coverage** — if a `sku_name` has no row in `list_prices`, report it as unpriced rather than silently dropping its usage from the cost total. ## Data scope - `system.billing.usage` — DBU consumption events per workspace/SKU/job/cluster - `system.billing.list_prices` — list prices per SKU (for dollarization) - No PII or sensitive customer data is accessed.
在 GitHub 查看