Daily
Get an alert when daily DBU spend goes over budget
If yesterday's DBU usage passed your budget, you know first thing in the morning.
- Runs
- Daily
- Apps
- Databricks
- AI
- Not needed
- Access
- system tables read + SQL warehouse
Send this to your assistant
Create a ClickRuntime automation: every morning at 8, add up yesterday's DBUs from system.billing.usage using my SQL warehouse and email me if the total is over 500.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Databricks spend grows in ways that are hard to see until the invoice arrives. A data engineer leaves an oversized cluster running, a notebook scheduled every hour loops over far more data than expected, and a month of quiet overspending turns into a number finance asks about. Cloud billing reports lag by a day or more.
Each day, this runs a SQL query through Databricks' statement execution API to total yesterday's DBUs, compares the result with the budget you set, and emails you if it was exceeded. You see overspend the next morning, not at month end.
Data platform owners and FinOps leads use it as a daily guardrail on Databricks consumption. The total is computed with a SQL query run through the statement execution API, so it uses your own usage data and the budget you set, not an estimate from a separate billing tool.
What you get out of it
Stop runaway spend within a day
A job that burns triple the usual DBUs is spotted the next morning. Shutting it down then costs a day of overspend, not a month of it. A job burning triple the usual DBUs is spotted the next morning, so shutting it down costs a day of overspend and not a month.
Hold teams to a clear budget
A daily DBU limit gives everyone the same reference. Teams adjust their usage knowing that an overrun will be noticed. A single daily limit gives every team the same reference, and they adjust their usage knowing an overrun will be noticed.
Trace the job behind the jump
If yesterday's usage jumped, the responsible job or cluster is easy to trace. The longer you wait, the harder the investigation becomes. If yesterday's usage jumped, the responsible job or cluster is easy to trace, and the trail goes cold quickly.
Give finance early warning
Finance learns about overspend before invoices arrive. That allows them to adjust forecasts instead of explaining a surprise to executives. Finance learns about overspend before invoices arrive, and can adjust forecasts instead of explaining a surprise.
Support cost reviews with real data
Each alert records a day when usage passed the budget. Those entries are helpful when reviewing which workloads cost the most. Each alert records a day when usage passed the budget, which helps when you review which workloads cost the most.
How it works
What happens, step by step
Every morning, ClickRuntime asks Databricks how many DBUs your workspace used yesterday.
It compares that total with the daily budget you set.
If yesterday went over, you get an email with the usage and your limit.
Before it runs live
- Connect Databricks
What you get
Build your own
Need it to work differently?
Your own rules
Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.
Any number of apps
One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.
AI where it helps
Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.
On a schedule or on each event
Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.
Changes you can ask for
- Run it at a different time, more or less often, or only on weekdays
- Add an AI step, for example to summarize, sort or draft a reply
- Add another app, for example also send it to Slack
- Combine it with other Databricks steps into one automation
Under the hood
The code that runs this automation
from clickruntime import on_trigger, credentials, http, notify
HOST = "https://dbc-a1b2c3d4-e5f6.cloud.databricks.com"
WAREHOUSE_ID = "1234567890abcdef"
LIMIT = 500
@on_trigger
def run(event):
resp = http.post(f"{HOST}/api/2.0/sql/statements",
headers={"Authorization": f"Bearer {credentials.secret('DATABRICKS_TOKEN')}"},
json={"warehouse_id": WAREHOUSE_ID, "wait_timeout": "30s",
"statement": "SELECT SUM(usage_quantity) FROM system.billing.usage "
"WHERE usage_unit = 'DBU' AND usage_date = current_date() - 1"})
resp.raise_for_status()
total = float(resp.json()["result"]["data_array"][0][0] or 0)
if total > LIMIT:
notify.email_me("Databricks DBUs over 500 yesterday", f"Yesterday's usage: {total:,.1f} DBUs (limit {LIMIT}).")
return {"dbus": total}FAQ
Common questions
Where does the DBU figure come from?
Does it need a running SQL warehouse?
Can I set different budgets per workspace?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Get a morning email of failed Databricks jobs
Each morning one email lists every job run that failed overnight, with links to each.
See how it worksGet a Slack alert when a job runs too long
Any run still going after two hours is flagged in Slack once, so stuck jobs don't burn compute all night.
See how it worksKnow the moment your website goes down
Your team hears in Slack when the site stops responding or slows down, and again when it's back.
See how it worksKeep exploring
Set up “Get an alert when daily DBU spend goes over budget” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.