fix: add ValidateSingleServer to avoid full scan in handleSingleServerByName - #1192
fix: add ValidateSingleServer to avoid full scan in handleSingleServerByName#1192aniketpandey05 wants to merge 3 commits into
Conversation
…rByName Signed-off-by: rogueslasher <aniketpandey25092005@gmail.com>
|
Warning Review limit reached
More reviews will be available in 12 minutes and 28 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds ChangesSingle-server validation refactor
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/broker/status.go`:
- Line 123: The log in handleSingleServerByName is per-request logging, not a
lifecycle event, so change the h.logger.Info call used for “Retrieved status for
specific server” to Debug while keeping the same serverName context. Locate the
logging statement in handleSingleServerByName and update the level to match the
logger.Debug guideline for /status/{name} requests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 65d61863-cbb8-4bcd-b6e9-3add91011bc4
📒 Files selected for processing (2)
internal/broker/broker.gointernal/broker/status.go
|
will fix |
Signed-off-by: rogueslasher <aniketpandey25092005@gmail.com>
|
@coderabbitai review |
✅ Action performedReview finished.
|
Signed-off-by: rogueslasher <aniketpandey25092005@gmail.com>
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@Patryk-Stefanski should i open an issue regarding this one thank you |
|
Yes, please create an issue, and we will review it once the issue is triaged |
handleSingleServerByNamewas callingValidateAllServers()to look up a singleserver by name, which iterates every registered upstream, builds a full aggregateStatusResponsewith health stats and a populated slice, then discards everythingexcept the one matching entry. This was already flagged by a
//TODO(craig)commentin the code.This PR introduces
ValidateSingleServer(name string)on theMCPBrokerinterface andmcpBrokerImpl, which acquiresmcpLock.RLock()and returns as soon as it findsa name match — avoiding the full scan, the wasted allocation, and the misleading"Server validation completed"log line on every single-server status request.Summary by CodeRabbit