Events and thresholds
Choose which events of a project go to which channel, with the error rate and duration that trigger an alert.
Choose the events of a project
PUT /v1/projects/{id}/alerts sets which events of the project go to which channel. It replaces all the project's subscriptions: up to 20, one per channel. An empty items list removes them all.
curl -X PUT https://dataflow.piloterr.com/v1/projects/PROJECT_ID/alerts \
-H "x-api-key: YOUR_API_KEY" -H "content-type: application/json" \
-d '{
"items": [
{
"channel_id": "SLACK_CHANNEL_ID",
"events": ["run.failed", "run.paused", "run.error_rate_exceeded", "credits.insufficient", "project.auto_disabled", "source.unreachable", "delivery.failed"],
"error_rate_pct": 5
},
{ "channel_id": "EMAIL_CHANNEL_ID", "events": ["run.completed"] }
]
}'| Field | Default | Effect |
|---|---|---|
channel_id | One of your channels. | |
events | At least one event from the list below. | |
error_rate_pct | null (10 %) | The share of failed rows, from 1 to 100, from which run.error_rate_exceeded is sent. |
max_duration_min | null | The duration, in minutes (1 or more), above which run.slow is sent. run.slow needs it. |
The answer is the saved list, as GET /v1/projects/{id}/alerts reads it back. A channel_id that is not one of your channels, or one given twice, is refused with 422 validation_failed, and nothing changes: error.details names it ("path": "items.0.channel_id", or "path": "items" with Each channel once).
In the dashboard, presets fill the events for you: Problems only (the failure events of the example above), Problems and changes, Every finished run (run.completed, run.failed, run.cancelled) and Everything.
Events
| Event | Sent when | data |
|---|---|---|
run.started | A run starts calling the endpoint. | |
run.resumed | A run continues after a restart of the service, or after a pause, once it stores its first new row: a run that pauses again at once sends nothing. | |
run.paused | A run pauses: the workspace is out of credits. A run that resumes and pauses again before storing a row sends it only once. | reason: insufficient_credits |
run.completed | A run completes. | |
run.failed | A run fails, whatever the reason: for instance error_rate, max_cost (the run's credits reached the project's max_cost_per_run), source_unreachable, api_key_invalid, paused_timeout, internal_error or endpoint_…: see statuses. | reason; when the input could not be read or mapped, also error, and issue for mapping_invalid |
run.cancelled | A run is cancelled: by you, whether it was queued, paused or under way, or by Piloterr. | reason, when Piloterr switched Dataflow off (killed_by_admin) or switched it off for your workspace (account_halted_by_admin) |
run.error_rate_exceeded | A run ends with at least error_rate_pct % of failed rows. | error_rate_pct: the run's share of failed rows (ko / done, one decimal); threshold_pct: the subscription's threshold; reason when the run failed |
run.slow | A run ends after more than max_duration_min minutes. | duration_ms, max_duration_min; reason when the run failed |
run.empty | A run ends without a single successful row, a run that fails before its first call included. | reason when the run failed |
credits.insufficient | A scheduled run is skipped: the balance does not cover it, or the workspace ran out of credits while its search input searched. schedule.skipped is sent too. | required, available and, for an endpoint billed per result or per GB, estimated: true; for a search, stage: "search" and available |
schedule.skipped | A scheduled run does not start, for instance because the previous one is still going (run_in_progress), credits are short (insufficient_credits), or Dataflow could not launch it (launch_error: it tries again at the next slot). See Schedules. | reason: why it could not start |
project.auto_disabled | The project stops after 5 failed scheduled runs in a row. Sent with the run.failed of the fifth. | reason: the fifth run's |
source.unreachable | The project's URL or search input cannot be read, or its search fails or finds nothing. The message says why. run.failed is sent too. A search out of credits sends credits.insufficient instead. | reason, error |
run.changes_detected | A completed run's results differ from the project's previous completed run: rows added, removed or changed. Not sent for the first run, nor for a retry of failed rows. See Compare runs for the rows themselves. | against_run_id, added, removed, changed, fields: the 10 fields changed in the most rows, as {"field": "price", "rows": 12} |
delivery.failed | An email or cloud storage delivery of the run's results still fails after its retries (about 30 minutes). The run stays as it was. | delivery_id, delivery (email or cloud), error |
run.error_rate_exceeded, run.slow and run.empty are checked when a run completes or fails, against each subscription's own thresholds. A cancelled run is not checked.
Every event's data may also hold suppressed_count (see How often alerts go out) and, on a test, test: true. Each event's full payload, the same one destinations receive, has its schema in the API reference.
A run that fails because the project's API key cannot be used is a run.failed with reason api_key_invalid. When it is the project's own key, it also stops the project until you choose another key, but sends no project.auto_disabled.
Good starting points: the failure events above for the team that fixes things, and run.completed, run.failed, run.cancelled for the people waiting for the data.