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(new_relic): retry NerdGraph's generic resolver-failure error (#87974)

Tom Owers53e7e777ac83
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/new_relic/new_relic.py b/products/warehouse_sources/backend/temporal/data_imports/sources/new_relic/new_relic.py
index 36349e7f03a7..953c15e5c800 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/new_relic/new_relic.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/new_relic/new_relic.py
@@ -196,7 +196,13 @@ def _execute_graphql(
if errors:
messages = "; ".join(str(error.get("message", error)) for error in errors)
# NerdGraph reports server-side timeouts/deadlines inside `errors` on an HTTP 200.
- if any(term in messages.lower() for term in ("timeout", "deadline", "too many requests")):
+ # "An error occurred resolving this field" is NerdGraph's generic resolver-failure
+ # message; it's known to fire intermittently on otherwise-valid queries and clear on
+ # retry (e.g. the New Relic Terraform provider retries the same message).
+ if any(
+ term in messages.lower()
+ for term in ("timeout", "deadline", "too many requests", "an error occurred resolving this field")
+ ):
raise NewRelicRetryableError(f"New Relic GraphQL error (retryable): {messages}")
raise NewRelicGraphQLError(f"New Relic GraphQL error: {messages}")
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/new_relic/tests/test_new_relic.py b/products/warehouse_sources/backend/temporal/data_imports/sources/new_relic/tests/test_new_relic.py
index 14fc9180c4c2..80b87b34b7f4 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/new_relic/tests/test_new_relic.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/new_relic/tests/test_new_relic.py
@@ -143,6 +143,7 @@ class TestExecuteGraphql:
("timeout", "NRQL query timeout after 120 seconds"),
("deadline", "Deadline exceeded"),
("throttled", "Too many requests"),
+ ("resolver_failure", "An error occurred resolving this field"),
]
)
def test_transient_graphql_errors_are_retryable(self, _name: str, message: str) -> None: