Monitors
A monitor is a rule checked each time a run finishes. When the run breaks the rule, Lantfly sends an alert to the bell, email and your alert channels. Use monitors to catch a scraper that starts failing, slows down, returns too few results, loses fields or costs too much.
Where rules live
- On an actor: the actor's Monitoring tab. The rule applies to every run of that actor in your account, including runs from tasks.
- On a task: the Monitoring section at the bottom of the task page. The rule applies only to that task's runs.
Settings → Notifications lists all your monitoring rules in a Monitoring alerts card and links to each one.
Rule types
| Rule | Alert when | Setting |
|---|---|---|
| Run status | A run fails, times out or is aborted | The statuses to alert on: Failed, Timed out, Aborted |
| Run takes too long | A run takes longer than the time you set | Longer than (minutes) |
| Too few results | A succeeded run returns fewer dataset items than expected | Fewer than (items) |
| Empty fields | In a succeeded run, too many items have one of the fields missing, null or empty | Fields and Empty in more than (%) |
| Run costs too much | A run is charged more than the amount you set (compute, results and events) | Costs more than (USD) |
Empty fields checks the first 1,000 items of the dataset (less when the items are very large; the alert then says
how many it checked). Field names can use dots for nested values, such as author.name.
Add a rule
- Open the actor's Monitoring tab (or the task's Monitoring section).
- Click Add rule, pick the rule under Alert when, fill in its setting and an optional Name.
- Click Add.
Each rule can be switched on and off, and deleted (its alert history goes with it). Recent alerts lists the last 50 alerts; click one to open its run. A rule alerts at most once per run.
Where alerts go
Alerts are sent as the actor.monitor notification: to the bell and by email by default, and to the account's alert
channels (Slack, Discord, Telegram, Zalo, webhook, email list). Each member chooses in Settings → Notifications.
See Notifications.
API
curl -s -X POST "https://lantfly.com/api/v3/monitors" \
-H "Authorization: Bearer $LANTFLY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"task_id": "YOUR_TASK_ID",
"name": "Daily crawl too small",
"type": "item_count",
"params": { "min_items": 50 }
}'
type | params |
|---|---|
run_status | statuses: any of FAILED, TIMED-OUT, ABORTED |
duration | max_secs |
item_count | min_items |
field_empty | fields (list), max_empty_pct |
cost | max_usd |
Send actor_id (ID or slug) or task_id. Other calls:
| Request | What it does |
|---|---|
GET /api/v3/monitors | Rules (filter with actor_id, task_id) and their last 50 alerts |
PATCH /api/v3/monitors/:monitor | Change name, is_active or params (type and target are fixed) |
DELETE /api/v3/monitors/:monitor | Delete the rule and its alert history |
GET /api/v3/monitors/events | Alert history, newest first |
An account can have up to 50 rules. In an organization, changing rules needs the permission to manage automation.