Skip to content

Commit b7b1f70

Browse files
committed
added supabase conectivity log and instructions on failure
1 parent f876a19 commit b7b1f70

3 files changed

Lines changed: 37 additions & 6 deletions

File tree

src/robusta/core/exceptions.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,12 @@ class NoAlertManagerUrlFound(Exception):
1414
"""Exception, when AlertManager url is incorrect"""
1515

1616
pass
17+
18+
19+
class SupabaseDnsException(Exception):
20+
"""Exception for Supabase DNS/connectivity issues (host resolution / firewall).
21+
22+
Raised when the runner cannot resolve or connect to the configured Supabase URL.
23+
"""
24+
25+
pass

src/robusta/core/sinks/robusta/dal/supabase_dal.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import threading
77
from typing import Any, Dict, List, Optional, Tuple
88
from uuid import uuid4
9-
109
from cachetools import TTLCache
1110
import requests
1211
from postgrest._sync.request_builder import SyncQueryRequestBuilder
@@ -18,6 +17,7 @@
1817
from supabase.lib.client_options import ClientOptions
1918

2019
from robusta.core.model.cluster_status import ClusterStatus
20+
from robusta.core.exceptions import SupabaseDnsException
2121
from robusta.core.model.env_vars import SUPABASE_TIMEOUT_SECONDS
2222
from robusta.core.model.helm_release import HelmRelease
2323
from robusta.core.model.jobs import JobInfo
@@ -541,10 +541,29 @@ def publish_helm_releases(self, helm_releases: List[HelmRelease]):
541541

542542
def sign_in(self) -> str:
543543
logging.info("Supabase dal login")
544-
res = self.client.auth.sign_in_with_password({"email": self.email, "password": self.password})
545-
self.client.auth.set_session(res.session.access_token, res.session.refresh_token)
546-
self.client.postgrest.auth(res.session.access_token)
547-
return res.user.id
544+
try:
545+
res = self.client.auth.sign_in_with_password({"email": self.email, "password": self.password})
546+
self.client.auth.set_session(res.session.access_token, res.session.refresh_token)
547+
self.client.postgrest.auth(res.session.access_token)
548+
return res.user.id
549+
except Exception as e:
550+
# Check if this is a DNS-related error
551+
error_msg = str(e).lower()
552+
if any(dns_indicator in error_msg for dns_indicator in [
553+
"temporary failure in name resolution",
554+
"name resolution",
555+
"dns",
556+
"name or service not known",
557+
"nodename nor servname provided"
558+
]):
559+
message = (
560+
f"\n{e}\nCannot connect to Robusta SaaS <{self.url}>. "
561+
f"\nThis is often due to DNS issues or Firewall policies. "
562+
f"\nPlease run the following command in your cluster and verify it does not print 'Could not resolve host': "
563+
f"\ncurl -I {self.url}\n"
564+
)
565+
raise SupabaseDnsException(message) from e
566+
raise
548567

549568
def to_db_cluster_status(self, data: ClusterStatus) -> Dict[str, Any]:
550569
db_cluster_status = data.dict()

src/robusta/model/config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from robusta.core.pubsub.events_pubsub import EventsPubSub
1212
from robusta.core.sinks.robusta.robusta_sink import RobustaSink
1313
from robusta.core.sinks.robusta.robusta_sink_params import RobustaSinkConfigWrapper, RobustaSinkParams
14+
from robusta.core.exceptions import SupabaseDnsException
1415
from robusta.core.sinks.sink_base import SinkBase
1516
from robusta.core.sinks.sink_config import SinkConfigBase
1617
from robusta.core.sinks.sink_factory import SinkFactory
@@ -91,7 +92,9 @@ def construct_new_sinks(
9192

9293
except Exception as e:
9394
has_sink_errors = True
94-
logging.error(f"Failed to initialize sink {sink_name}: {e}", exc_info=True)
95+
# Don't show trace for Robusta SaaS DNS-related exception to avoid hiding the error in noisy logs
96+
exec_info = not isinstance(e, SupabaseDnsException)
97+
logging.error(f"Failed to initialize sink {sink_name}: {e}", exc_info=exec_info)
9598
if not continue_on_sink_errors:
9699
raise
97100
# Skip this sink if continue_on_sink_errors is True

0 commit comments

Comments
 (0)