Here's a made-up example. A team's core ledger node drops off at 2 a.m. because its physical host loses power. The node has a dozen threshold rules, such as CPU > 90%, disk > 85%, and API error rate > 1%, and nobody gets paged that night. Once the node is gone, its metrics stop, PromQL returns an empty result, and an empty result matches no comparison. The team then adds no-data alerts to every service. Now each time Kubernetes scales down and deletes old Pods, it leaves behind a batch of no-data alerts that never recover. Two weeks later there are over a hundred of them.
An empty query result means one of three things: a target stopped reporting while running, a target never produced data, or the alert object is gone and the problem went with it. Each needs its own trigger and its own recovery. Treat them all the same and you either miss the outage or bury your alert list under leftovers from normal scale-downs.
Threshold rules don't fire on empty results
A threshold rule compares numbers: is memory above 90%, are there more than 10 slow queries. It assumes the data source returns a number every cycle. When the collection pipeline breaks, a process exits, or a scheduled job never starts, the query returns nothing. Nothing is neither above 90 nor below it, so the rule stays quiet.
The usual Prometheus workaround is absent(), which returns a result only when the whole expression returns nothing. Take a service running on 50 machines:
- With one
absent(up{job="pay-core"})rule, nothing fires as long as one machine still reports. You won't see the other 49 go down. - To catch a single machine, you need 50 rules with 50 hard-coded instance labels, and you edit them every time the fleet scales.
up itself is a special case. In pull mode, while a target is still in service discovery, a failed scrape writes up=0, and a plain up == 0 threshold works. Empty results show up for every other metric, when a target leaves service discovery, and when an agent pushes metrics through remote write.
Three kinds of empty result
| Case | Examples | How to detect | How to recover |
|---|---|---|---|
| Had data, then stopped | Host power loss, collector exits, business heartbeat stops | Remember every object seen; alert when one is missing for N cycles | When data returns; add a timeout if the object may never return |
| Never had data | New zone missing its scrape job, batch script never starts because of a permission error | Alert when the whole query is empty for N cycles | When any query returns data again |
| No data means healthy | Error-log search, SQL for stuck orders; threshold alerts on deleted Pods | Alert only when data is found | When the object stops appearing, but only if the query itself succeeded |
Had data, then stopped
Detection has to work per object. The engine remembers each label set (one series) it has seen. When a series goes missing for several cycles, the engine fires an alert that carries that series' own labels. You write one query and don't list machines.
Recovery is the hard part. It depends on whether the object comes back:
- Physical hosts, databases, and long-running gateways either come back or get fixed by someone. Keep the alert open until data reappears. For core nodes, you can require a manual close so someone checks the host first.
- Kubernetes Pods and autoscaled instances don't come back after a scale-down. If recovery waits for data, the alert never ends. That's where the hundred leftover alerts in the example came from. For these objects, add a timeout to recovery.
A timeout only fixes alerts that never end. The scale-down itself still fires one missing-data alert. If scale-downs shouldn't alert at all, aggregate the query to a stable dimension, such as count by (deployment) (up{job="pay-core"} == 1). That series goes missing only when a whole Deployment has no live instance.
Never had data
Per-object detection needs to see an object before it has a baseline. If a target has no data from the very first cycle, per-object detection stays silent. For example, a new availability zone is missing its scrape job, or the 2 a.m. settlement script never starts because of a permission error.
This case needs a second check: alert when the whole query is empty for N cycles. Turn on both checks. The first catches targets that drop out; the second catches targets that never started.
No data means healthy
A filtering query returns zero rows when things are fine, such as a log search for fatal error keywords or a SQL query for stuck orders. These rules fire when they find rows and recover when they don't.
The case people miss is a threshold alert whose object disappears. Container pay-7f9c hits 95% memory and fires. Two minutes later a rolling deploy deletes it, and pod="pay-7f9c" never returns another value. If recovery only accepts "value back under the threshold," the alert stays active forever.
So recovery has to count "object no longer returned" as healthy, but only when the query succeeded. A timed-out or failed query also returns no object. Recovering on that would mistake a collection failure for a fix.
Two more sources of false alerts
Ingestion lag. Data takes time to become queryable. If the query window ends at the current second, the latest cycle may not be written yet and looks missing. Shift the query window back with a time offset.
The alert engine itself. When the engine stops, none of its rules run and nothing alerts. Silence then says nothing about your systems, so the engine needs its own liveness check.
Setting it up in Flashduty Monitors
Flashduty Monitors runs alert rules on an alert engine, monitedge, deployed inside your network. The architecture is described in Keep monitoring data local and manage alerting in one place. Alert conditions have three tabs: Threshold evaluation, Missing data, and Data exists. The cases above map to them like this:
| Case | Tab | Option |
|---|---|---|
| Had data, then stopped | Missing data | Alert if previously found data is now missing |
| Never had data | Missing data | Alert when all queries return no data |
| Filtering query, rows mean trouble | Data exists | Default recovery is "Recover if no data" |
| Threshold alert's object disappears | Threshold evaluation | Also count a check as normal when the alert object returns no data |
Missing data tab
The two conditions are two check cards in one tab. You enable each separately and give each its own level (Critical, Warning, or Info). For example, set the all-empty check to Critical and per-object dropouts to Warning. Trigger settings work as on the other tabs; by default an alert fires after 3 consecutive hits.
Alert if previously found data is now missing needs a single query, such as up{job="pay-core"}. The engine checks every series it has observed. Pick one of three recovery modes based on how long the object lives:
| Object | Recovery mode |
|---|---|
| Physical host, database, long-running gateway | End automatically when data reappears (default); for core nodes that need a human check, Manual close only |
| Kubernetes Pod, autoscaled instance | End when data reappears or the timeout expires, with an automatic close timeout in seconds |
Alert when all queries return no data always recovers automatically once any query returns data again.
Two things to watch:
- When the engine restarts, missing counts start over. An object that had just gone missing and hadn't reached the alert count before the restart isn't reported afterward.
- For SQL and log data sources, label fields define the alert object. If you make a column that changes every cycle a label, such as the heartbeat time
last_seen, every cycle creates a new object and the previous one is reported as missing. See When label fields is empty.
Examples for each data source are in Prometheus alert rules: No data mode.
Data exists tab
Use this tab for log searches and stuck-order SQL: the rule fires when the query returns rows and recovers on the next check that returns none. One rule produces one alert level; use threshold evaluation if you need several. For logs, see Flashduty Monitors: Alert on Loki and VictoriaLogs queries. For SQL, see Alerting on business data with SQL.
Recovering threshold alerts when the object disappears
When threshold recovery is set to Recovery when no thresholds are triggered or Recovery only when conditions are met, you can check Also count a check as normal when the alert object returns no data. New rules have it checked by default. Existing rules keep their behavior until you check it on the edit page.
Where the line is drawn:
- The full set of label values identifies an alert object. A check counts as normal only when every query in the alert conditions succeeds and none returns the object. If only some queries return it, the count neither grows nor resets.
- Failed queries, timeouts, and results over the row limit never count as normal.
- These checks share the consecutive count in Recovery condition with checks where the threshold clears.
- A recovery caused by a missing object carries the label
__alert_rule_recovery_reason=data_absent, and its values are the ones from the last alert.
This option requires alert engine v0.77.0 or later. For an enabled rule, saving or enabling it with this option checked is rejected if any cluster the rule matches has an older engine or no registered engine.
Threshold evaluation and Missing data are independent tabs in the same rule. A Pod's memory alert recovers once the Pod is deleted. If the disappearance itself should alert, turn on the Missing data tab too. Full details are in Alert rule reference: Alert recovery.
Query time offset
Set Query Time Offset in seconds under the rule's Detection frequency and effective time settings. A value of 60 shifts the query window back by 60 seconds. It applies only to Prometheus, Loki, VictoriaLogs, SLS, and Tencent CLS data sources. If your data arrives late, start with 30 to 60 seconds. See Detection frequency and effective time.
Keeping the engine itself covered
Engine liveness has two layers:
- One instance fails: instances in the same data center that share a cluster name form a cluster. When one fails, the others take over its rules.
- The whole cluster goes dark: configure a rule under Data ingestion → Edge engines → Engine Disconnection Alert. It doesn't fire while any instance in the cluster is alive. It fires only after every instance has been disconnected for the configured time (120 seconds by default).
If an instance's process is still up but rule sync is stuck or rule evaluation keeps failing, the disconnection alert won't fire. The engine exposes metrics for its connection to the center, rule sync, and rule evaluation at /metrics (port 6868 by default). Scrape them into your own Prometheus and evaluate them on a different system, not on the engine being monitored. See Engine disconnection alert and Engine self-monitoring metrics.
You can try it free in the Flashduty console.




