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(warehouse_sources): add instatus outages and generic notices tables (#111522)

Tom Owersad6524224aa6
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 0b8e716d452e..2549757fb5d8 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
@@ -4371,14 +4371,14 @@ Note: Full OpenAPI 3.1 spec is public and unauthenticated. Note /leads and /lead
## Instatus — gaps
-Today (9): `audience_groups`, `components`, `incidents`, `maintenances`, `metrics`, `pages`, `subscribers`, `team`, `templates`
+Today (11): `audience_groups`, `components`, `generic_notices`, `incidents`, `maintenances`, `metrics`, `outages`, `pages`, `subscribers`, `team`, `templates`
Diffed against: <https://instatus.com/help/api>
-- [ ] `GET /v1/{page_id}/outages` — component outage history — the uptime metric a status page exists to report (high)
-- [ ] `GET /v1/{page_id}/incidents/{incident_id}/incident-updates` — incident status transition history (investigating -> identified -> resolved); needed for MTTR (high)
-- [ ] `GET /v1/{page_id}/maintenances/{maintenance_id}/maintenance-updates` — maintenance state transitions matching the maintenances we already sync (medium)
-- [ ] `GET /v1/{page_id}/generic-notices` — banner notices posted on the status page outside the incident model (low)
+- [x] `GET /v1/{page_id}/outages` — component outage history — the uptime metric a status page exists to report (high). Added as `outages` (fan-out over `pages`).
+- [ ] `GET /v1/{page_id}/incidents/{incident_id}/incident-updates` — skipped: the API has no list route here, only `GET .../incident-updates/{incident_update_id}`. Every update is already embedded in the `updates` array of each `incidents` row.
+- [ ] `GET /v1/{page_id}/maintenances/{maintenance_id}/maintenance-updates` — skipped: the API has no list route here, only `GET .../maintenance-updates/{maintenance_update_id}`. Every update is already embedded in the `updates` array of each `maintenances` row.
+- [x] `GET /v1/{page_id}/generic-notices` — banner notices posted on the status page outside the incident model (low). Added as `generic_notices` (fan-out over `pages`).
Note: Existing 'team' table maps to the teammates endpoint (GET /v1/{page_id}/team) and 'pages' to GET /v2/pages, so those are covered. Metric data points are POST/DELETE only — there is no GET for metric datapoints, so metric time series is not fetchable. escalation-policies, monitors, on-call-schedules, routing-rules and monitoring-integrations doc pages expose no GET list endpoints.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/instatus/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/instatus/canonical_descriptions.py
index 85e9cc5429d3..ca2e22df4b11 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/instatus/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/instatus/canonical_descriptions.py
@@ -132,4 +132,37 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"components": "Components associated with the audience group.",
},
},
+ "outages": {
+ "description": "Periods during which a component was degraded or down, used to compute uptime.",
+ "docs_url": f"{_DOCS}/outages",
+ "columns": {
+ "id": "Unique identifier for the outage.",
+ "page_id": _PAGE_ID_COLUMN,
+ "from": "Timestamp when the outage started.",
+ "to": "Timestamp when the outage ended, or null if it is ongoing.",
+ "status": "Severity of the outage (e.g. DEGRADEDPERFORMANCE, PARTIALOUTAGE, MAJOROUTAGE).",
+ "visibilityState": "Whether the outage is published on the status page.",
+ "component": "The affected component (id and name).",
+ "incident": "The incident linked to the outage (id, name, status), or null.",
+ "createdAt": "Timestamp when the outage was created.",
+ "updatedAt": "Timestamp when the outage was last updated.",
+ },
+ },
+ "generic_notices": {
+ "description": "Persistent banner notices shown on a status page, separate from incidents and maintenances.",
+ "docs_url": f"{_DOCS}/generic-notices",
+ "columns": {
+ "id": "Unique identifier for the notice.",
+ "page_id": _PAGE_ID_COLUMN,
+ "name": "Title of the notice.",
+ "message": "Body of the notice.",
+ "messageHtml": "Body of the notice rendered as HTML.",
+ "notify": "Whether subscribers were notified about the notice.",
+ "isCollapsed": "Whether the notice is collapsed by default on the status page.",
+ "siteId": "Identifier of the status page (site) the notice belongs to.",
+ "importedFrom": "Source the notice was imported from, if any.",
+ "createdAt": "Timestamp when the notice was created.",
+ "updatedAt": "Timestamp when the notice was last updated.",
+ },
+ },
}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/instatus/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/instatus/settings.py
index 8e8ba63a5a14..8bac57024ff5 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/instatus/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/instatus/settings.py
@@ -82,6 +82,19 @@ INSTATUS_ENDPOINTS: dict[str, InstatusEndpointConfig] = {
path="/v1/{page_id}/audience-groups",
primary_key=["page_id", "id"],
),
+ "outages": InstatusEndpointConfig(
+ name="outages",
+ path="/v1/{page_id}/outages",
+ primary_key=["page_id", "id"],
+ # An outage's `from` can be edited after creation, so partition on createdAt instead.
+ partition_key="createdAt",
+ ),
+ "generic_notices": InstatusEndpointConfig(
+ name="generic_notices",
+ path="/v1/{page_id}/generic-notices",
+ primary_key=["page_id", "id"],
+ partition_key="createdAt",
+ ),
}
ENDPOINTS = tuple(INSTATUS_ENDPOINTS.keys())
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/instatus/tests/test_instatus.py b/products/warehouse_sources/backend/temporal/data_imports/sources/instatus/tests/test_instatus.py
index 792844f85ea4..4a50bd5be69a 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/instatus/tests/test_instatus.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/instatus/tests/test_instatus.py
@@ -141,27 +141,35 @@ class TestPagesEndpoint:
class TestFanOut:
+ @pytest.mark.parametrize(
+ "endpoint, url_suffix",
+ [
+ ("components", "components"),
+ # Schema names use underscores, but the API path is hyphenated.
+ ("generic_notices", "generic-notices"),
+ ],
+ )
@mock.patch(CLIENT_SESSION_PATCH)
- def test_fans_out_over_pages_and_injects_page_id(self, MockSession):
+ def test_fans_out_over_pages_and_injects_page_id(self, MockSession, endpoint, url_suffix):
session = MockSession.return_value
urls, _ = _wire(
session,
[
_response([{"id": "p1"}, {"id": "p2"}]), # /v2/pages page 1
- _response([{"id": "c1"}]), # /v1/p1/components page 1
- _response([]), # /v1/p1/components page 2 (stop)
- _response([{"id": "c2"}]), # /v1/p2/components page 1
- _response([]), # /v1/p2/components page 2 (stop)
+ _response([{"id": "c1"}]), # /v1/p1/<endpoint> page 1
+ _response([]), # /v1/p1/<endpoint> page 2 (stop)
+ _response([{"id": "c2"}]), # /v1/p2/<endpoint> page 1
+ _response([]), # /v1/p2/<endpoint> page 2 (stop)
_response([]), # /v2/pages page 2 (stop)
],
)
- rows = _rows(_source("components", _make_manager()))
+ rows = _rows(_source(endpoint, _make_manager()))
# page_id injected so the composite [page_id, id] key stays unique table-wide.
assert rows == [{"id": "c1", "page_id": "p1"}, {"id": "c2", "page_id": "p2"}]
- assert "https://api.instatus.com/v1/p1/components" in urls
- assert "https://api.instatus.com/v1/p2/components" in urls
+ assert f"https://api.instatus.com/v1/p1/{url_suffix}" in urls
+ assert f"https://api.instatus.com/v1/p2/{url_suffix}" in urls
@mock.patch(CLIENT_SESSION_PATCH)
def test_resumes_fan_out_at_saved_parent_and_page(self, MockSession):
@@ -271,6 +279,8 @@ class TestInstatusSourceResponse:
("templates", "createdAt"),
("incidents", "started"),
("maintenances", "start"),
+ ("outages", "createdAt"),
+ ("generic_notices", "createdAt"),
("subscribers", None),
("metrics", None),
],