Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(data-warehouse): add hatchet scheduled runs table (#111301)

Tom Owers5a6a20e9c53d
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
index 12ae097a2f95..9222a4d85b7f 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md
@@ -3912,17 +3912,17 @@ Note: Harvey publishes six OpenAPI specs (listed in https://developers.harvey.ai
## Hatchet — gaps
-Today (8): `event_keys`, `events`, `task_events`, `task_timings`, `tasks`, `workers`, `workflow_runs`, `workflows`
+Today (9): `event_keys`, `events`, `scheduled_runs`, `task_events`, `task_timings`, `tasks`, `workers`, `workflow_runs`, `workflows`
Diffed against: <https://raw.githubusercontent.com/hatchet-dev/hatchet/main/api-contracts/openapi/openapi.yaml>
- [x] `workflows (GET /api/v1/tenants/{tenant}/workflows)` — lookup resolving the workflow ID carried on every synced workflow run and task (high)
-- [ ] `workflow versions (GET /api/v1/workflows/{workflow}/versions)` — returns one version per call (latest, or one by id), so there is no listable version history to sync (high)
+- [ ] `workflow versions (GET /api/v1/workflows/{workflow}/versions)` — returns one version per call (latest, or one by id), so there is no listable version history to sync (high). Skipped: the latest version per workflow is a single-object read with no listing, and older versions are not listable.
- [x] `task events (GET /api/v1/stable/tasks/{task}/task-events, GET /api/v1/stable/workflow-runs/{id}/task-events)` — state-transition history (queued, started, retried, failed) behind each task's final status (high)
- [x] `workers (GET /api/v1/tenants/{tenant}/worker, GET /api/v1/workers/{worker})` — lookup identifying which worker executed a synced task, plus worker availability (high)
-- [ ] `task metrics (GET /api/v1/stable/tenants/{tenant}/task-metrics, /task-point-metrics, /task-stats)` — the vendor's headline throughput and status-count series for queue health dashboards (medium)
-- [ ] `queue metrics (GET /api/v1/tenants/{tenant}/queue-metrics, /step-run-queue-metrics)` — backlog depth per queue - the standard capacity-planning metric (medium)
-- [ ] `scheduled runs (GET /api/v1/tenants/{tenant}/workflows/scheduled)` — upcoming and past scheduled triggers, joinable to workflow_runs (medium)
+- [ ] `task metrics (GET /api/v1/stable/tenants/{tenant}/task-metrics, /task-point-metrics, /task-stats)` — the vendor's headline throughput and status-count series for queue health dashboards (medium). Skipped: `task-metrics` returns status counts for whatever window is requested and `task-point-metrics` changes bucket width with the requested range, so neither has a stable row grain (both are derivable from `tasks`). `task-stats` is a live queued/running gauge for autoscalers, with no history.
+- [ ] `queue metrics (GET /api/v1/tenants/{tenant}/queue-metrics, /step-run-queue-metrics)` — backlog depth per queue - the standard capacity-planning metric (medium). Skipped: `queue-metrics` is deprecated and returns 400 on current Hatchet, and `step-run-queue-metrics` is a point-in-time gauge with no history to sync.
+- [x] `scheduled runs (GET /api/v1/tenants/{tenant}/workflows/scheduled)` — upcoming and past scheduled triggers, joinable to workflow_runs (medium)
- [ ] `crons (GET /api/v1/tenants/{tenant}/workflows/crons)` — cron definitions that explain the trigger source of recurring runs (medium)
- [x] `task timings (GET /api/v1/stable/workflow-runs/{id}/task-timings)` — per-task duration breakdown within a run - latency attribution (medium)
- [ ] `tenant members (GET /api/v1/tenants/{tenant}/members)` — membership table for the tenant whose runs are synced (medium)
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hatchet/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hatchet/canonical_descriptions.py
index a1c1eb5c6a0a..b178cf42e16c 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hatchet/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hatchet/canonical_descriptions.py
@@ -138,6 +138,28 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"workflow_run_created_at": "Time at which the parent workflow run was created.",
},
},
+ "scheduled_runs": {
+ "description": "A one-off scheduled trigger of a Hatchet workflow, upcoming or already fired, linked to the workflow run it created.",
+ "docs_url": "https://docs.hatchet.run/home/scheduled-runs",
+ "columns": {
+ "id": "Unique identifier for the scheduled run.",
+ "created_at": "Time at which the scheduled run was created.",
+ "updated_at": "Time at which the scheduled run was last updated.",
+ "tenantId": "Identifier of the tenant that owns the scheduled run.",
+ "workflowId": "Identifier of the workflow to trigger.",
+ "workflowName": "Name of the workflow to trigger.",
+ "workflowVersionId": "Identifier of the workflow version to trigger.",
+ "triggerAt": "Time at which the workflow is scheduled to run.",
+ "input": "The input payload the workflow is triggered with.",
+ "additionalMetadata": "Arbitrary key-value metadata attached to the scheduled run.",
+ "workflowRunId": "Identifier of the workflow run created when the schedule fired, if any.",
+ "workflowRunName": "Name of the workflow run created when the schedule fired, if any.",
+ "workflowRunStatus": "Status of the workflow run created when the schedule fired, if any.",
+ "workflowRunCreatedAt": "Time at which the triggered workflow run was created, if any.",
+ "method": "How the schedule was created: DEFAULT (declared in code) or API.",
+ "priority": "Priority of the triggered run, from 1 to 3.",
+ },
+ },
"task_timings": {
"description": "Queued, started, and finished times of each task in a Hatchet workflow run, for latency attribution.",
"docs_url": "https://docs.hatchet.run/home/runs-and-tasks",
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hatchet/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hatchet/settings.py
index 50d2d68d6588..994a8f0fd64f 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hatchet/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hatchet/settings.py
@@ -141,6 +141,17 @@ HATCHET_ENDPOINTS: dict[str, HatchetEndpointConfig] = {
partition_key="created_at",
incremental_fields=[],
),
+ # Scheduled (one-off, future-dated) workflow triggers, past and upcoming. No time filter, and the
+ # trigger time and linked run status change after creation, so full refresh only. The API defaults
+ # to `triggerAt DESC`, which shifts under offset pagination when a schedule is rescheduled, so
+ # page by creation time instead.
+ "scheduled_runs": HatchetEndpointConfig(
+ name="scheduled_runs",
+ path="/api/v1/tenants/{tenant}/workflows/scheduled",
+ partition_key="created_at",
+ incremental_fields=[],
+ extra_params={"orderByField": "createdAt", "orderByDirection": "ASC"},
+ ),
# State-transition history of every task in a run. The API returns all of a run's events in one
# response (no pagination), so this fans out once per workflow run.
"task_events": HatchetEndpointConfig(
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hatchet/tests/test_hatchet_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hatchet/tests/test_hatchet_source.py
index 48c697f982ed..68f945f3015a 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hatchet/tests/test_hatchet_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hatchet/tests/test_hatchet_source.py
@@ -121,6 +121,7 @@ class TestHatchetSource:
"event_keys",
"workflows",
"workers",
+ "scheduled_runs",
"task_events",
"task_timings",
}