Fix nil error logging in probe registration#874
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe probe agent's registerServer now captures HTTP response status and up to 1024 bytes of the response body on non-200/201 replies, and logs a formatted error containing that information while keeping retry/backoff behavior unchanged. ChangesServer Registration Error Logging
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 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 |
Fixes #785 Signed-off-by: Stefan Hipfel <stefan.hipfel@sap.com>
ee5642e to
1ecf4b0
Compare
| @@ -221,7 +223,8 @@ func (a *Agent) registerServer(ctx context.Context) error { | |||
| }() | |||
|
|
|||
| if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { | |||
There was a problem hiding this comment.
@afritzler do we want to retry on all errors? 401 or 403 for example won't fix themselves
There was a problem hiding this comment.
IMO I would keep it simple for now. But you are are of course right.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
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/probe/probe.go`:
- Around line 226-227: The call to io.ReadAll(io.LimitReader(resp.Body, 1024))
currently ignores its returned error which can hide read failures; modify the
code around the resp handling (where body, _ :=
io.ReadAll(io.LimitReader(resp.Body, 1024)) and the subsequent a.log.Error call
occur) to capture the read error (e.g., body, err := io.ReadAll(...)), and
include that error in the a.log.Error invocation or its message (alongside
resp.StatusCode, the body string and "url", a.RegistryURL) so read failures are
reported instead of discarded.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7b98ae21-b03a-4bd6-a547-be75c21e6bed
📒 Files selected for processing (1)
internal/probe/probe.go
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Stefan Hipfel <stefan.hipfel@sap.com>
f9f6ef8 to
ef8ba72
Compare
Remove duplicate return statement on line 233 that was causing govet unreachable code error. The duplicate return was accidentally added and made the code after it unreachable. Signed-off-by: Stefan Hipfel <stefan.hipfel@sap.com>
81cefd5 to
8fd18f7
Compare
Fixes #785
Summary by CodeRabbit