-
Notifications
You must be signed in to change notification settings - Fork 181
Less server errors when not connected to saas #993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
WalkthroughConditionalize the Robusta sync at server startup to run only when dal.enabled and config.cluster_name are set; otherwise log a debug skip. Adjust Sentry tag initialization so account_id_tag uses dal.account_id only when dal.enabled is true; otherwise None. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Server
participant DAL
participant RobustaSync as Robusta Sync
participant Sentry
rect rgba(200,230,255,0.3)
note over Server: Startup
Server->>DAL: Check dal.enabled
Server->>Server: Read config.cluster_name
alt dal.enabled && cluster_name
Server->>RobustaSync: Run sync()
RobustaSync-->>Server: Result/complete
else not enabled or missing cluster_name
Server-->>Server: Log debug "skip sync"
end
end
rect rgba(220,255,220,0.3)
note over Server,Sentry: Initialize Sentry tags
Server->>DAL: Get account_id (if enabled)
alt dal.enabled
Server->>Sentry: setTag(account_id = dal.account_id)
else
Server->>Sentry: setTag(account_id = None)
end
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
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. Comment |
There was a problem hiding this 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 (2)
server.py (2)
84-84
: Add a return type hint to comply with typing guidelines.Recommend annotating the function return type.
-def sync_before_server_start(): +def sync_before_server_start() -> None:
114-121
: Avoid sending None-valued tags to Sentry; set account_id only when enabled.
set_tags
expects string values; passingNone
can result in an unintended "None"/null tag or type issues. Build the tag map conditionally.- sentry_sdk.set_tags( - { - "account_id": dal.account_id if dal.enabled else None, - "cluster_name": config.cluster_name, - "version": get_version(), - "environment": environment, - } - ) + tags = { + "cluster_name": config.cluster_name, + "version": get_version(), + "environment": environment, + } + if dal.enabled and getattr(dal, "account_id", None): + tags["account_id"] = str(dal.account_id) + sentry_sdk.set_tags(tags)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
server.py
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.py
: Always place Python imports at the top of the file, not inside functions or methods
All Python code must include type hints (mypy enforced)
Files:
server.py
🧬 Code graph analysis (1)
server.py (3)
holmes/config.py (1)
dal
(120-123)holmes/utils/holmes_status.py (1)
update_holmes_status_in_db
(8-23)holmes/utils/holmes_sync_toolsets.py (1)
holmes_sync_toolsets_status
(24-61)
⏰ 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: llm_evals
- GitHub Check: Pre-commit checks
🔇 Additional comments (1)
server.py (1)
85-98
: SaaS-gated startup sync looks good; reduces failures when no token/cluster name.This should eliminate the startup exceptions when SaaS isn’t configured. Please verify that constructing
config.dal
itself does not perform network I/O or raise when the token is missing; otherwise consider deferring DAL construction until inside the gated block.
I've tested in the case where SaaS is not available (i.e. no token) - please also test on happy path where it is available and verify everything still works.