Skip to content

Conversation

@Avi-Robusta
Copy link
Contributor

on failure now prints error like

2025-10-30 11:36:36.514 ERROR    Failed to initialize sink robusta_ui_sink:
[Errno -2] Name or service not known
Cannot connect to Robusta SaaS <https://test.supabase.co>.
This is often due to DNS issues or Firewall policies.
Please run the following command in your cluster and verify it does not print 'Could not resolve host':
curl -I https://test.supabase.co

@coderabbitai
Copy link

coderabbitai bot commented Oct 30, 2025

Warning

Rate limit exceeded

@Avi-Robusta has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 10 minutes and 11 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 2310e70 and 8a601a9.

📒 Files selected for processing (1)
  • src/robusta/core/sinks/robusta/dal/supabase_dal.py (2 hunks)

Walkthrough

Adds a new SupabaseDnsException and uses it to detect DNS/connectivity errors during Supabase sign-in; when raised its traceback is suppressed in sink construction and playbook package reload logging, while other exceptions retain full tracebacks.

Changes

Cohort / File(s) Summary
Exception Definition
src/robusta/core/exceptions.py
Adds new SupabaseDnsException(Exception) with a descriptive docstring and constructor storing the original exception and URL.
Supabase DAL Integration
src/robusta/core/sinks/robusta/dal/supabase_dal.py
Imports SupabaseDnsException; wraps sign_in() authentication call in try/except, detects DNS-like error messages and raises SupabaseDnsException with a detailed message, re-raising unrelated exceptions.
Configuration Error Handling
src/robusta/model/config.py
Imports SupabaseDnsException; in construct_new_sinks sets exc_info=False when caught exception is SupabaseDnsException (suppress traceback) and exc_info=True otherwise; preserves existing control flow.
Playbook Reload Logging
src/robusta/runner/config_loader.py
In ConfigLoader.__reload_playbook_packages, captures exceptions as e and conditions exc_info on isinstance(e, SupabaseDnsException) to suppress tracebacks for that exception while showing them for others.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant Config as construct_new_sinks\n(model/config.py)
    participant ConfigLoader as __reload_playbook_packages\n(runner/config_loader.py)
    participant DAL as supabase_dal.sign_in
    participant SupabaseSDK as Supabase SDK

    Caller->>Config: request sink creation
    Config->>DAL: call sign_in()
    DAL->>SupabaseSDK: authenticate

    alt DNS / connectivity error
        SupabaseSDK-->>DAL: socket.gaierror / DNS error
        DAL->>DAL: detect DNS-like message
        DAL-->>Config: raise SupabaseDnsException(original, url)
        Config->>Config: log error (exc_info=False)
        Config-->>Caller: mark sink error / skip sink
    else Other exception
        SupabaseSDK-->>DAL: other exception
        DAL-->>Config: propagate original exception
        Config->>Config: log error (exc_info=True)
        Config-->>Caller: handle/raise per existing flow
    else Success
        SupabaseSDK-->>DAL: auth success
        DAL-->>Config: return credentials
        Config-->>Caller: continue normal flow
    end

    Note right of Caller: Later, during playbook reload
    Caller->>ConfigLoader: trigger reload
    ConfigLoader->>ConfigLoader: try reload packages
    alt SupabaseDnsException during reload
        ConfigLoader-->>ConfigLoader: log error (exc_info=False)
    else Other exception
        ConfigLoader-->>ConfigLoader: log error (exc_info=True)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review DNS-detection heuristics in supabase_dal.py for accuracy and false positives.
  • Verify that suppressing tracebacks for SupabaseDnsException aligns with observability and support practices.
  • Confirm tests or error-logging expectations around construct_new_sinks and __reload_playbook_packages.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "[ROB-2094] added supabase conectivity log and instructions on failure" directly relates to the main changes in the changeset. The modifications add a new SupabaseDnsException class, implement DNS-specific error detection and handling in the Supabase DAL, and modify logging behavior to suppress tracebacks for these errors while providing user-friendly instructions. The title accurately captures this core objective of enhancing error messaging and user guidance for Supabase connectivity failures. The title is specific, concise, and clearly conveys the primary purpose of the changes.
Description Check ✅ Passed The pull request description is directly related to the changeset. It provides a concrete example of the improved error output that results from the changes, showing the new error format with helpful diagnostic instructions for users encountering Supabase connectivity issues. The description demonstrates the practical outcome of the code modifications—specifically, how the new exception handling and logging changes produce user-facing messages with DNS troubleshooting guidance. The description is clear, relevant, and not vague or off-topic.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/robusta/core/sinks/robusta/dal/supabase_dal.py (1)

544-566: Good DNS error handling with actionable user guidance.

The implementation correctly detects DNS-related connectivity errors and provides users with clear troubleshooting steps. The DNS detection heuristic covers common error messages, and the exception chaining preserves the original context.

Optional: Address static analysis hint

Consider moving the return statement to an else block as suggested by Ruff (TRY300) for slightly clearer control flow:

 def sign_in(self) -> str:
     logging.info("Supabase dal login")
     try:
         res = self.client.auth.sign_in_with_password({"email": self.email, "password": self.password})
         self.client.auth.set_session(res.session.access_token, res.session.refresh_token)
         self.client.postgrest.auth(res.session.access_token)
-        return res.user.id
     except Exception as e:
         # Check if this is a DNS-related error
         error_msg = str(e).lower()
         if any(dns_indicator in error_msg for dns_indicator in [
             "temporary failure in name resolution",
             "name resolution",
             "dns",
             "name or service not known",
             "nodename nor servname provided"
         ]):
             message = (
                 f"\n{e.__class__.__name__}: {e}\nCannot connect to Robusta SaaS <{self.url}>. "
                 f"\nThis is often due to DNS issues or Firewall policies. "
                 f"\nPlease run the following command in your cluster and verify it does not print 'Could not resolve host': "
                 f"\ncurl -I {self.url}\n"
             )
             raise SupabaseDnsException(message) from e
         raise
+    else:
+        return res.user.id
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b7b1f70 and 90bffb9.

📒 Files selected for processing (1)
  • src/robusta/core/sinks/robusta/dal/supabase_dal.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/robusta/core/sinks/robusta/dal/supabase_dal.py (1)
src/robusta/core/exceptions.py (1)
  • SupabaseDnsException (19-25)
🪛 Ruff (0.14.2)
src/robusta/core/sinks/robusta/dal/supabase_dal.py

548-548: Consider moving this statement to an else block

(TRY300)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: run_tests
  • GitHub Check: run_tests
🔇 Additional comments (1)
src/robusta/core/sinks/robusta/dal/supabase_dal.py (1)

20-20: LGTM!

The import of SupabaseDnsException is correctly placed and supports the DNS error handling added to the sign_in method.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/robusta/runner/config_loader.py (1)

275-281: Good approach to reduce log noise for DNS errors.

The conditional traceback suppression logic is sound: DNS-related exceptions provide user-friendly messages with troubleshooting steps, making stack traces unnecessary, while other exceptions retain full debugging context.

Minor polish: remove trailing whitespace on Line 277 and consider rephrasing the comment for clarity:

-            except Exception as e:
-                print_exception = not isinstance(e, SupabaseDnsException) # Don't show trace for Robusta SaaS DNS-related exception to avoid hiding the error in noisy logs
-                
+            except Exception as e:
+                # Suppress traceback for DNS exceptions; their custom message is more helpful than a stack trace
+                print_exception = not isinstance(e, SupabaseDnsException)
+
                 logging.error(
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 90bffb9 and 2310e70.

📒 Files selected for processing (3)
  • src/robusta/core/exceptions.py (1 hunks)
  • src/robusta/core/sinks/robusta/dal/supabase_dal.py (2 hunks)
  • src/robusta/runner/config_loader.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/robusta/runner/config_loader.py (1)
src/robusta/core/exceptions.py (1)
  • SupabaseDnsException (19-33)
src/robusta/core/sinks/robusta/dal/supabase_dal.py (1)
src/robusta/core/exceptions.py (1)
  • SupabaseDnsException (19-33)
🪛 Ruff (0.14.2)
src/robusta/runner/config_loader.py

275-275: Do not catch blind exception: Exception

(BLE001)

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

548-548: Consider moving this statement to an else block

(TRY300)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: run_tests
  • GitHub Check: run_tests
🔇 Additional comments (4)
src/robusta/runner/config_loader.py (1)

46-46: LGTM!

The import of SupabaseDnsException is correctly placed and enables DNS-specific error handling.

src/robusta/core/exceptions.py (1)

19-33: Excellent custom exception implementation!

The SupabaseDnsException class provides clear, actionable error messages for DNS/connectivity failures. The message format includes:

  • The original error details
  • The problematic URL
  • Troubleshooting guidance with a concrete curl command

Storing original_exception and url as attributes enables programmatic access if needed downstream.

src/robusta/core/sinks/robusta/dal/supabase_dal.py (2)

20-20: LGTM!

The import enables DNS-specific exception handling in the sign-in flow.


544-561: DNS error detection is comprehensive and properly implemented.

Verification confirms the exception handling is sound:

  • Keywords cover common DNS failures across Python and glibc: "temporary failure in name resolution", "name resolution", "dns", "name or service not known", "nodename nor servname provided"
  • These patterns match standard socket.gaierror messages across Python versions
  • SupabaseDnsException provides actionable troubleshooting guidance with curl command
  • Exception chaining via raise ... from e correctly preserves the original error context
  • No competing DNS error patterns elsewhere in the codebase, ensuring consistency

The generic exception catching with message filtering is appropriate for the Supabase client library, which wraps network errors. No changes needed.

@Avi-Robusta Avi-Robusta requested a review from RoiGlinik November 2, 2025 11:13
@Avi-Robusta Avi-Robusta merged commit f6878cf into master Nov 6, 2025
8 checks passed
@Avi-Robusta Avi-Robusta deleted the supabase-dns-error branch November 6, 2025 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants