Outcome expectations
A job can finish without an error and still do the wrong thing: import zero records, produce no file, or skip its work. Outcome expectations check a few values the job reports when it completes. CronRadar stores only each value and whether its check passed, never the job's data.
Define expectations
Open a job in the console and add checks under Outcome checks in its settings. Changing them requires the Admin or Owner role. Each job can have up to five checks, on every plan. Each check has:
- Label: a readable name, up to 100 characters.
- SDK key: the key the job reports, such as
records_processed. It starts with a lowercase letter and uses only lowercase letters, numbers, and underscores, up to 64 characters. Keys are unique within a job. - Type: a number or a boolean (true or false).
- Expectation: for a number, equal to, at least, or at most a value. For a boolean, is true or is false.
Examples: records_processed at least 1, errors equal to 0, successful is true.
Through the API, send the full list as outcomeExpectations when updating the job; the list replaces the existing checks.
Report values
Report values on the completion event, as a JSON body on POST /complete:
curl --fail-with-body --silent --show-error --max-time 5 --request POST \
--user "$CRONRADAR_API_KEY:" \
--header "Content-Type: application/json" \
--data '{"outcomes":{"records_processed":842,"errors":0,"successful":true}}' \
"https://cron.life/api/v1/ping/nightly-import/complete"- Send at most five values, each a finite JSON number or boolean. The body can be up to 4096 bytes.
- Keys that no check uses are accepted and dropped.
- The whole report is rejected with
400if a key is invalid, a value is not a number or boolean, there are more than five values, or the JSON is malformed.
The .NET SDK takes values through the outcomes argument of CompleteJobAsync, and the Hangfire integration through CronRadarOutcome.Report(key, value) inside the job. The other SDKs do not report outcome values; use the HTTP call above. See the HTTP API reference for both authentication styles.
How checks are evaluated
CronRadar evaluates every check when a completion or heartbeat arrives for a job that has checks:
- A check passes when its value was reported, has the right type, and meets the expectation.
- A value that was not reported fails its check. A heartbeat carries no values, so every check fails on a heartbeat; use the completion event for jobs with checks.
- Start and fail events are not evaluated.
When any check fails, the run's result is outcomefailed, the job becomes critical, and an incident opens with an OutcomeFailure alert. The alert explains each failed check, for example Records processed: observed 0; expected >= 1 (failed). If the job already has an open incident, such as a missed run, no second alert is sent.
When a later completion passes every check, the incident closes and CronRadar sends Recovered. A completion that fails a check does not close an incident.
What is stored
Each evaluation keeps the key, label, expectation, the reported number or boolean, whether it was reported, and whether it passed. Nothing else from the report is stored. Evaluations follow your plan's run-history retention.
Never report job arguments, payloads, database records, logs, secrets, or personal data as outcomes.