You describe an alert in the form. The tool writes the Airflow code for it and opens a
pull request against Twigeo/analytics. A data engineer reviews and merges.
Airflow picks it up and the alert starts running. You never write Python.
1 Fill in the form
→
2 Dry run to check it
→
3 Create alert rule → PR
→
4 DE reviews & merges
→
5 Live in ~5 min
Before you start
Two sign-ins, both one-time. Google gets you into the tool. Connect GitHub
(top right) lets the tool open pull requests under your own name rather than a bot's,
so reviewers can see who asked for what. If the GitHub link says "Connect" rather than
showing a green tick, click it before submitting anything.
GitHub tokens expire after 8 hours. If a submit or the "existing alerts" list suddenly
fails, reconnect GitHub and try again.
Filling in the form
Client → Table → Source → Metrics
These four cascade, and the order matters. Each one is read from live Snowflake data,
so what you see is what actually exists.
Client
Every client with a utils/<client>_utils.py file in the analytics repo.
Table / report
Every Snowflake table belonging to that client. New tables appear here automatically.
Data source
The distinct values in that table's source column — Google,
Apple, Facebook_skan, and so on. These come from the data
itself, which is why they're capitalised differently from the source names used
elsewhere in the repo.
Metrics / KPIs
Numeric columns on the selected table. Text columns like country and
campaign_name are deliberately excluded — you can't sum them. Add as
many as you want; the rule is checked against each one separately.
Rule types
Rule
Fires when
Reach for it when
Spike detection
Yesterday's value is X% above the average of the previous N days
Runaway spend, a tracking bug double-counting installs
Drop detection
Yesterday's value is X% below that same baseline
A campaign silently stopping, conversions collapsing
Missing data
Yesterday has fewer rows than you expect
A pipeline not delivering — the most common alert
Threshold breach
Yesterday's total crosses a fixed number
A hard limit: spend over budget, CPI above target
Custom SQL
Your own query returns a result matching a condition you choose
Anything the four above can't express
Spike & drop
% threshold
How far yesterday has to move before it counts. 50 means "at least 50% up" (spike) or "at least 50% down" (drop).
Baseline window
How many days to average for comparison. Short windows react fast but are noisy at
weekends; 7 or 14 days usually behaves well. The baseline excludes yesterday.
Missing data
Expected rows per day
Fires when yesterday delivers fewer than this. Pick a number comfortably below
normal volume — a dry run tells you what normal looks like.
Break down by
Optional, and worth using. Without it, one source's rows can mask another's absence:
a table can hold thousands of Apple rows while Google delivers nothing, and the
total still looks healthy. Break down by platform or country
and each value is checked on its own, firing if any one of them is short.
A group that disappears completely is caught too — the check compares against the
values seen over the last 7 days, not just what turned up yesterday.
Scope
Automatically limited to the data source you picked above. Nothing to set.
Threshold breach
Absolute value & comparison
Sums the metric across yesterday and compares it to your number. Greater than, less than, or equals.
Custom SQL
The metrics field disappears for this rule — your query decides what's measured, and
the fire condition decides when it alerts.
SQL query
Pre-filled with a starter query built from the columns your table actually has, so
it runs as-is. Edit freely. {{table}} and {{date}} work as
placeholders. SELECT and WITH only — writes are rejected.
Fire when
Query returns any rows — write the query so rows only come back when
something is wrong. Query returns no rows — the inverse: rows mean healthy, silence means trouble. First column > 0 — for a query returning a single computed number. Row count > threshold — tolerate a few bad rows, alert past that point.
Check frequency
Daily at a specific time
Pick any time, UTC. Set it late enough that the upstream pipeline has finished, or the alert will fire on data that simply hasn't landed yet.
After the source DAG completes
Runs as soon as the upstream DAG finishes, whenever that happens. Usually the better choice — no guessing about timing.
Slack channel
Searchable list of real channels, read live from Slack. For the bot to post in a
channel it has to be a member, so run this in Slack once per new channel:
/invite @twigeo_alert_builder
Message template
These placeholders are filled in when the alert fires:
{client} — client id
{source} — data source
{table} — table name
{metric} — which metric tripped
{value} — the measured number
{change} — what the rule compared, in words
{date} — the date checked
Single braces. {{metric}} prints literally rather than substituting.
Dry run
Runs your rule against real Snowflake data immediately. No pull request, no Slack
message, nothing written anywhere — use it as often as you like while tuning a
threshold. It's the fastest way to find out whether a rule is too noisy or too quiet
before anyone else sees it.
Would fire / would not fire
What the rule concludes about yesterday's data.
Value
The number tested. On a broken-down missing-data check this is labelled
Worst group or Lowest group, because there's a number per group
rather than one for the table.
Slack message preview
Exactly what would land in the channel, placeholders resolved.
Query result
The rows behind the verdict. On a broken-down check every group is listed with a
pass/fail marker, so you can see that all of them were evaluated — not just the
one named in the summary.
SQL that ran
Copy it into your own Snowflake session to dig further.
Download CSV
The full result set, not just the first ten rows shown on screen.
Existing alerts
Picking a client lists the alerts already live for them, read from
master. Click a row to expand it — table, metrics, rule parameters,
Slack channel, who created it and when.
Delete opens a pull request removing that rule. The alert keeps running until
that PR is merged; deleting here is a request, not an immediate stop. If you need
something silenced right now, ask a data engineer to merge it promptly.
What happens after you submit
A pull request appears on Twigeo/analytics, authored by you.
It adds or updates dags/alerts/<client>_alerts.py. One file per client; each rule is an entry in a list inside it.
A data engineer reviews and merges.
MWAA picks up the file within about five minutes.
The alert runs on its schedule and posts to Slack when it fires.
One DAG per client, one task per rule. Adding a second rule for a client appends to
the same file rather than creating a new one.
When something goes wrong
"looks like a text/dimension column"
The metric isn't numeric. Pick one that is — the dropdown should only offer numeric columns, so this usually means a hand-edited rule.
Dry run fails with a Snowflake error
Usually a typo in custom SQL. The error text comes straight from Snowflake; the "SQL that ran" panel shows exactly what was sent.
The alert never fires
Dry run it. If the dry run says "would not fire", the threshold is too lenient for the data.
The alert fires every day
Too strict. Raise the threshold or widen the baseline window, and dry run until it only fires on genuinely unusual days.
Nothing arrives in Slack even though it fired
The bot probably isn't in the channel. Run /invite @twigeo_alert_builder there.
A submit or the alerts list fails unexpectedly
GitHub token expired — reconnect GitHub from the header.
Soundtrack Assistant
Ask questions about Soundtrack's paid marketing data. Answers come from the Snowflake
Cortex agent PROD.TWIGEO1.SOUNDTRACK_AGENT — check the numbers against the
table and SQL before trusting the summary.