Record and query background_job_completed
Document what each background_job_completed row represents and which service sends it. Send test events to check the fields, then verify that the query answers your question.
- 1
Outcome becomes final
Worker after success or permanent failure emits only after the job succeeds or exhausts its retry policy.
- 2
Choose the fields
11 required fields preserve the declared grain: One terminal outcome per logical job.
- 3
Check the test event
Check types, UTC time, alternate outcomes, idempotency, and every pseudonymous or review-classified field.
- 4
Query the result
Which jobs fail, retry, wait, or run slowly?
Grain
One terminal outcome per logical job.
Owner
Worker after success or permanent failure
Emit when
After the job succeeds or exhausts its retry policy.
Field contract
Field types and data to exclude
Keep field names and types stable once production queries depend on them. Document optional fields and add them only when they answer a specific question.
| Field | Type | Required | Privacy | Meaning |
|---|---|---|---|---|
| timestamp_utc | timestamp | yes | non-sensitive | UTC time when the operation finishes. |
| event_id | string | yes | non-sensitive | Stable unique identifier used for deduplication. |
| release | string | yes | non-sensitive | Application or service version that emitted the event. |
| account_id | string | yes | pseudonymous | Stable internal account identifier, never an email or name. |
| job_id | string | yes | pseudonymous | Stable logical job identifier. |
| job_name | string | yes | non-sensitive | Low-cardinality job type. |
| queue_name | string | yes | non-sensitive | Queue that executed the job. |
| attempt_count | number | yes | non-sensitive | Total attempts including the final attempt. |
| queue_wait_ms | number | yes | non-sensitive | Time from enqueue to first execution. |
| duration_ms | number | yes | non-sensitive | Terminal attempt duration. |
| status | string | yes | non-sensitive | Success or permanent error. |
Synthetic JSON event
{
"timestamp_utc": "2026-07-28T14:22:02Z",
"event_id": "evt_job_01",
"account_id": "acct_8f31",
"release": "2026.07.2",
"job_id": "job_31be",
"job_name": "workspace_export",
"queue_name": "exports",
"attempt_count": 2,
"queue_wait_ms": 340,
"duration_ms": 8420,
"status": "success"
}Privacy review
Review identifiers before ingestion
This example uses synthetic identifiers. Pseudonymous values can still be personal data, and review fields can expose business or provider context. Apply your own consent, retention, access, residency, and deletion requirements.
account_id: pseudonymousjob_id: pseudonymous
Validation checklist
Test the schema before building a dashboard
- Send one known background_job_completed fixture after the documented outcome boundary.
- Verify all 11 required fields arrive with the documented types.
- Retry the same event identifier and confirm the chosen deduplication behavior.
- Send a controlled failure or alternate outcome when the workflow supports one.
- Run the related SQL over a fixed window and reconcile the result to the fixture.
Common mistakes
Record one result per row
- Emitting background_job_completed before worker after success or permanent failure knows the final outcome.
- Mixing different kinds of results in one table, which makes counts and rates ambiguous.
- Replacing controlled categories with raw URLs, payloads, prompts, or error text.
- Changing a field type in place after saved queries and dashboards depend on it.
- Adding identifiers without a documented investigation, access, and retention need.
Use the contract
Query the event and set up monitoring
Related contracts
Send a test event before production traffic
Create a free API key, send the synthetic event, and inspect the inferred table before connecting a live workflow.