: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(data-warehouse): add 1 missing table to the Hetzner source (#117569)
Tom Owersaf73d2b6d8af
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.mdindex 9a917eeb33d3..60cc28e370db 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@@ -5832,7 +5832,7 @@ Diffed against: <https://docs.hetzner.cloud/cloud.spec.json>- [x] `GET /pricing` — lookup table of hourly/monthly prices per server type, volume, load balancer and location — the only way to cost the servers we already sync (high)- [x] `GET /servers/{id}/metrics` — cpu, disk and network time series per server, the headline analytical data in the API (high)- [x] `GET /zones` — DNS zones, now part of the Cloud API and not exposed at all today (medium)-- [ ] `GET /zones/{id_or_name}/rrsets` — DNS records per zone — the actual queryable rows behind zones (medium)+- [x] `GET /zones/{id_or_name}/rrsets` — DNS records per zone — the actual queryable rows behind zones (medium)- [x] `GET /load_balancers/{id}/metrics` — connections, throughput and requests per load balancer for capacity analysis (medium)- [x] `GET /networks/{id}/members` — servers and load balancers attached to each network, with their private IP and attach status (medium)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/canonical_descriptions.pyindex 8080e602dd65..ee7ab008e715 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/canonical_descriptions.py@@ -285,4 +285,18 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"status": "Status of the resource within the network: ok, attaching, detaching, updating or error.",},},+ "zone_rrsets": {+ "description": "DNS resource record sets (RRSets) of each zone. One row per record name and type.",+ "docs_url": _API_DOCS,+ "columns": {+ "zone": "ID of the zone the RRSet belongs to.",+ "id": "ID of the RRSet, composed of its name and type joined with a slash (e.g. www/AAAA).",+ "name": "Name of the RRSet relative to the zone. The zone apex is @.",+ "type": "DNS record type of the RRSet, e.g. A, AAAA, CNAME, MX or TXT.",+ "ttl": "Time to live (TTL) of the RRSet, in seconds. Null when the zone's default TTL applies.",+ "records": "Records of the RRSet, each with its value and an optional comment.",+ "protection": "Protection configuration of the RRSet.",+ "labels": "User-defined key/value labels attached to the RRSet.",+ },+ },}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/settings.pyindex a342ca06f680..a61524f868aa 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/settings.py@@ -216,6 +216,17 @@ HETZNER_CHILD_ENDPOINTS: dict[str, HetznerChildEndpointConfig] = {primary_keys=["network_id", "type", "id"],sort="id:asc",),+ # DNS records of each zone, grouped by name and type. The `id` ("www/A") is unique only within+ # its zone, and each row already carries the zone id in `zone`.+ "zone_rrsets": HetznerChildEndpointConfig(+ name="zone_rrsets",+ parent="zones",+ parent_id_column="zone",+ path_suffix="/rrsets",+ response_key="rrsets",+ primary_keys=["zone", "id"],+ sort="id:asc",+ ),}ENDPOINTS = (*HETZNER_ENDPOINTS.keys(), *HETZNER_METRICS_ENDPOINTS.keys(), *HETZNER_CHILD_ENDPOINTS.keys())diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/tests/test_hetzner.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/tests/test_hetzner.pyindex fbfbaa641cdb..20a258042c2d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/tests/test_hetzner.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hetzner/tests/test_hetzner.py@@ -26,7 +26,6 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.hetzner.heHETZNER_BASE_URL,METRICS_RETENTION,HetznerResumeConfig,- hetzner_child_source,hetzner_metrics_source,validate_credentials,)@@ -265,27 +264,52 @@ class TestMetrics:assert result.paths == ["/v1/servers", "/v1/servers/1/metrics", "/v1/servers/2/metrics"]-class TestNetworkMembers:- @mock.patch(CLIENT_SESSION_PATCH)- def test_deleted_or_empty_network_is_skipped(self, MockSession) -> None:- session = MockSession.return_value- _wire_requests(- session,+class TestChildEndpoints:+ @parameterized.expand(+ [+ (+ "network_members",+ "networks",+ "members",+ {"type": "server", "id": 9, "ip": "10.0.0.2"},+ {"network_id": 3, "type": "server", "id": 9, "ip": "10.0.0.2"},+ ),+ (+ "zone_rrsets",+ "zones",+ "rrsets",+ {"id": "www/A", "name": "www", "type": "A", "zone": 3, "records": [{"value": "198.51.100.7"}]},+ {"zone": 3, "id": "www/A", "name": "www", "type": "A", "records": [{"value": "198.51.100.7"}]},+ ),+ ]+ )+ def test_fans_out_over_parents_and_skips_deleted_or_empty_ones(+ self,+ endpoint: str,+ parent: str,+ child_key: str,+ child_row: dict[str, Any],+ expected_row: dict[str, Any],+ ) -> None:+ result = _driver().run(+ endpoint,[- _page([{"id": 1}, {"id": 2}, {"id": 3}], endpoint="networks"),- _json_response({"error": {"code": "not_found"}}, status=404, reason="Not Found"),- _page([], endpoint="members"),- _page([{"type": "server", "id": 9}], endpoint="members"),+ _scripted_page([{"id": 1}, {"id": 2}, {"id": 3}], endpoint=parent),+ ScriptedResponse(status=404, json={"error": {"code": "not_found"}}),+ _scripted_page([], endpoint=child_key),+ _scripted_page([child_row], endpoint=child_key),],)- manager = _make_manager()-- rows = _rows(- hetzner_child_source(api_token="token", endpoint="network_members", resumable_source_manager=manager)- )- assert rows == [{"network_id": 3, "type": "server", "id": 9}]- assert manager.safe_point.call_count == 2+ assert result.raised is None+ assert result.rows == [expected_row]+ assert result.paths == [+ f"/v1/{parent}",+ f"/v1/{parent}/1/{child_key}",+ f"/v1/{parent}/2/{child_key}",+ f"/v1/{parent}/3/{child_key}",+ ]+ assert result.params("sort") == ["id:asc"] * 4class TestRetries: