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.

fix(warehouse-sources): stop reporting Open-Meteo transport blips as bugs (#103268)

Tom Owers472a066866cf
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/open_meteo/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/open_meteo/source.py
index aef6c96d7c4a..bc494413f96d 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/open_meteo/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/open_meteo/source.py
@@ -113,6 +113,19 @@ class OpenMeteoSource(ResumableSource[OpenMeteoSourceConfig, OpenMeteoResumeConf
"Open-Meteo rejected the request": "Open-Meteo rejected the request. Check the locations and historical start date on this source, then reconnect.",
}
+ def get_retryable_errors(self) -> set[str]:
+ # `_get_with_redacted_errors` has no retry loop of its own — it relies on the tracked
+ # session's urllib3 adapter to retry a connection failure, read timeout, or 429/5xx
+ # response. Once that budget is exhausted, the failure still carries an Open-Meteo host:
+ # a connection/timeout failure escapes with the host baked into urllib3's own message
+ # (`HTTPSConnectionPool(host='...', port=443): ...`), and an exhausted 429/5xx reaches
+ # `_fetch`'s `raise_for_status()` fallback, whose message carries the request URL instead.
+ # Either way Temporal retries the whole activity from the saved window/location checkpoint,
+ # so this is transient and self-recovering rather than a bug. Every Open-Meteo host is one
+ # of our own fixed hosts (never user input), so matching on the bare domain covers both
+ # message shapes without risking an unrelated failure.
+ return {"open-meteo.com"}
+
def get_schemas(
self,
config: OpenMeteoSourceConfig,
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/open_meteo/tests/test_open_meteo_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/open_meteo/tests/test_open_meteo_source.py
index 10e0d6fe5c28..7bcc1c33594d 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/open_meteo/tests/test_open_meteo_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/open_meteo/tests/test_open_meteo_source.py
@@ -137,6 +137,30 @@ class TestOpenMeteoSource:
# retry a permanent failure forever.
assert error_message_matches(raised_message, self.source.get_non_retryable_errors().keys())
+ @pytest.mark.parametrize(
+ "raised_message",
+ [
+ "HTTPSConnectionPool(host='archive-api.open-meteo.com', port=443): "
+ "Max retries exceeded with url: /v1/archive?latitude=48.86&longitude=2.35 "
+ "(Caused by ReadTimeoutError(\"HTTPSConnectionPool(host='archive-api.open-meteo.com', "
+ 'port=443): Read timed out. (read timeout=60)"))',
+ "HTTPSConnectionPool(host='customer-api.open-meteo.com', port=443): "
+ "Max retries exceeded with url: /v1/forecast (Caused by "
+ "NewConnectionError('Failed to establish a new connection'))",
+ # `_fetch`'s `raise_for_status()` fallback fires once the tracked session's own 429/5xx
+ # retries are exhausted; its message carries the request URL rather than urllib3's
+ # connection-pool wording.
+ "500 Server Error: Internal Server Error for url: https://api.open-meteo.com/v1/forecast",
+ ],
+ )
+ def test_transport_connection_errors_match_the_retryable_patterns(self, raised_message: str) -> None:
+ # `_get_with_redacted_errors` has no retry loop of its own once urllib3's own retry budget
+ # is exhausted, so a plain read-timeout, connection failure, or exhausted-retry HTTP error
+ # against Open-Meteo's own fixed hosts must be recognized here — otherwise it escapes
+ # unclassified and gets reported to error tracking as a bug instead of a transient,
+ # self-recovering blip.
+ assert error_message_matches(raised_message, self.source.get_retryable_errors())
+
def test_resumable_manager_is_namespaced_per_schema(self) -> None:
manager = self.source.get_resumable_source_manager(_inputs("weather_current"))