Skip to main content

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​

RuleAlert whenSetting
Run statusA run fails, times out or is abortedThe statuses to alert on: Failed, Timed out, Aborted
Run takes too longA run takes longer than the time you setLonger than (minutes)
Too few resultsA succeeded run returns fewer dataset items than expectedFewer than (items)
Empty fieldsIn a succeeded run, too many items have one of the fields missing, null or emptyFields and Empty in more than (%)
Run costs too muchA 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​

  1. Open the actor's Monitoring tab (or the task's Monitoring section).
  2. Click Add rule, pick the rule under Alert when, fill in its setting and an optional Name.
  3. 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​

Alert when a task returns fewer than 50 items
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 }
}'
typeparams
run_statusstatuses: any of FAILED, TIMED-OUT, ABORTED
durationmax_secs
item_countmin_items
field_emptyfields (list), max_empty_pct
costmax_usd

Send actor_id (ID or slug) or task_id. Other calls:

RequestWhat it does
GET /api/v3/monitorsRules (filter with actor_id, task_id) and their last 50 alerts
PATCH /api/v3/monitors/:monitorChange name, is_active or params (type and target are fixed)
DELETE /api/v3/monitors/:monitorDelete the rule and its alert history
GET /api/v3/monitors/eventsAlert history, newest first

An account can have up to 50 rules. In an organization, changing rules needs the permission to manage automation.