Skip to content

Hourly

Get alerted when a metric crosses a limit

A query runs every hour and you hear in Slack as soon as the value passes your threshold.

Runs
Hourly
Apps
BigQuery
AI
Not needed
Access
read

Send this to your assistant

Create a ClickRuntime automation: every hour, count failed orders in the last hour from shop.orders and post to #ops in Slack if there are more than 20.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A growth team watches a number that matters: signups per hour, failed payments in the last day, queue depth in an events table, revenue against a daily floor. In BigQuery that number is one query away, but nobody runs it every hour. A tracking bug that drops signups to zero on a Friday evening is discovered Monday, after the whole weekend of paid traffic was wasted.

On an hourly schedule, ClickRuntime runs the BigQuery query you define, compares the single value it returns with your limit, and sends a notification only when the limit is crossed. You choose the query and the direction of the comparison, for example below 50 signups or above 1,000 errors. When the metric is healthy, nothing is sent.

It works well for engineers and analysts who already have a trusted SQL definition of the metric and want it to speak up on its own.

What you get out of it

  • Broken tracking found in hours

    If an event pipeline stops writing rows, the hourly count drops and the alert fires that same afternoon. Spotting a silent break early limits how much bad or missing data piles up before someone repairs it.

  • Ad spend stops going to nowhere

    A sudden fall in conversions while campaigns keep spending is expensive. A notification when the metric crosses its floor lets someone pause budget within the hour instead of at the next weekly review.

  • One definition of the metric

    The threshold is checked against your own SQL, so the alert agrees with the number your team already reports. There is no second tool computing a slightly different figure that people argue about.

  • Quiet when things are fine

    Only a crossed limit produces a message, so people do not learn to ignore it. A channel that speaks rarely gets read when it does, and that matters during a real incident.

  • Fewer manual dashboard checks

    Analysts stop opening the same dashboard each morning to confirm nothing changed. That time moves to investigating the alerts that actually mean something. That reclaimed time matters most for small teams where one analyst covers every report.

How it works

What happens, step by step

  1. Every hour, ClickRuntime runs your BigQuery query, such as failed charges in the last hour.

  2. It compares the result with the limit you set.

  3. When the value goes over the limit, it posts to your #alerts Slack channel, such as "Failed charges in the last hour: 41 (threshold 25)".

  4. It only alerts once while the value stays high, and is ready to alert again after it drops back.

Before it runs live

  • Connect BigQuery

What you get

RunsHourly
Get alerted when a metric crosses a limittoday, 9:00Succeeded
Slack · #alertsFailed charges in the last hour: 41 (threshold 25)

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • 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 BigQuery steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
data_threshold_alert.pyexample
from clickruntime import on_trigger, credentials, http, state, notify

PROJECT = "my-project"
SQL = "SELECT COUNTIF(status = 'failed') FROM payments.charges WHERE created_at >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR)"
THRESHOLD = 25

@on_trigger
def run(event):
    res = http.post(f"https://bigquery.googleapis.com/bigquery/v2/projects/{PROJECT}/queries",
                    headers={"Authorization": f"Bearer {credentials.connection('google', 'work')}"},
                    json={"query": SQL, "useLegacySql": False}).json()
    value = float(res["rows"][0]["f"][0]["v"] or 0)
    over = value > THRESHOLD
    if over and not state.get("alerting"):
        notify.slack(f"Failed charges in the last hour: {value:.0f} (threshold {THRESHOLD})", channel="#alerts")
    state.set("alerting", over)
    return {"value": value, "over": over}

FAQ

Common questions

What kind of query works for a threshold check?
The query should return one numeric value, such as a COUNT or SUM over a recent window. The run compares that value with your limit. Queries that return many rows need to be reduced in SQL first, for example with an aggregate and a time filter.
Will it keep notifying me every hour while the metric stays bad?
As described, each hourly run that finds the value past the limit sends a notification. If that would be noisy, you can ask for it to alert only on the first crossing and again on recovery. Review the change before approving it.
Does each run cost me BigQuery query charges?
Each run executes a query job, and BigQuery bills according to the data scanned under your own Google Cloud billing. Filtering on a partitioned timestamp column, and selecting only needed columns, keeps hourly checks inexpensive.
What permissions does it need?
read. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it runs (hourly). Checks that find nothing to do and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Get alerted when a metric crosses a limit” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.