fix(byoo-otel-collector): log otelcol-contrib exit error on shutdown#219
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe CLI now captures and logs errors returned by Changesotelcol-contrib lifecycle handling
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
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 `@src/compute-plane-services/byoo-otel-collector/internal/cli/cli.go`:
- Around line 75-77: Add regression tests for the otel collector wait-error
handling in both interrupt shutdown and secret-triggered restart, configuring
fakeProcess.waitErr and asserting the logger records the error from
otelCollectorProc.Wait. Cover both affected wait paths and preserve existing
behavior; only omit tests if the merge-request description documents the
specific reason.
🪄 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: Enterprise
Run ID: e1f70d70-bbc0-4932-8c8d-ae11fce4db5c
📒 Files selected for processing (1)
src/compute-plane-services/byoo-otel-collector/internal/cli/cli.go
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 `@src/compute-plane-services/byoo-otel-collector/internal/cli/cli_test.go`:
- Around line 46-48: Update the tests around the interrupt and secret-triggered
restart cases to exercise their real shutdown and restart control-flow branches,
including the corresponding runSecretsCheckLoop call sites, rather than invoking
waitAndLogProcessExit directly. Alternatively, explicitly rename them as
helper-level tests to reflect their limited coverage.
- Around line 53-54: Update the test setup around logger.Logger to capture its
original value before replacing it with the observer logger, then register
t.Cleanup to restore the original global logger after the test completes.
- Around line 58-64: Update the test’s log assertions after logs.TakeAll() to
inspect the captured entry for non-nil wait-error cases. In addition to
verifying the expected entry count, assert that its message or error field
contains tt.waitErr.Error(), while preserving the existing no-entry assertion
when tt.wantLog is false.
🪄 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: Enterprise
Run ID: e0f3122e-3480-4364-8603-51e034e155b5
📒 Files selected for processing (3)
src/compute-plane-services/byoo-otel-collector/internal/cli/BUILD.bazelsrc/compute-plane-services/byoo-otel-collector/internal/cli/cli.gosrc/compute-plane-services/byoo-otel-collector/internal/cli/cli_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- src/compute-plane-services/byoo-otel-collector/internal/cli/cli.go
|
This looks good; can you make a github issue for it? |
|
Filed #267 and linked it in the description. |
|
@mesutoezdil , can you please rebase off of main? It should fix the codeql failures. |
fac8528 to
dbcfddc
Compare
|
done, thx |
byoo-otel-collector, nvcf-unbound, and the four workers (worker-init, worker-llm-credentials, worker-task, worker-utils) each have their own MODULE.bazel and a public OCI base (nvcr.io/nvidia/distroless/go, digest anonymously pullable), but were never added as matrix rows. So a change touching only one of them (e.g. #219 for byoo, which even edits cli_test.go) matched no row, produced an empty matrix, and skipped Bazel entirely with a green check. Add them so their build and tests run on PRs and main. nvsnap remains the only intentional exclusion (private, non-public OCI base; see the detect comment). Rows start with tests enabled; any that fail tests in the GHA environment will be flipped to build-only with a tracking issue, per the documented policy. Co-authored-by: Balaji Ganesan <bganesan@nvidia.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Head branch was pushed to by a user without write access
dbcfddc to
abd320b
Compare
runSecretsCheckLoop discarded the error from Process.Wait() after both a graceful shutdown and a secrets-triggered restart, so a non-zero or signal exit from otelcol-contrib was silently dropped. Log it instead. Verified with go build, go vet, go test ./..., and golangci-lint --enable-only errcheck, all clean. NO-REF Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
Extract the duplicated wait-and-log logic behind otelCollectorProc.Wait() into waitAndLogProcessExit, taking a small interface instead of the concrete *os.Process so both the interrupt and secret-triggered restart paths can be exercised with a fake in a unit test. JIRA: NO-REF NVBug: none Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
Clarify the test names as helper-level coverage, restore the global logger after each case, and assert the logged message contains the underlying wait error text instead of only counting log entries. JIRA: NO-REF NVBug: none Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
abd320b to
101666b
Compare
TL;DR
runSecretsCheckLoop discarded the error from Process.Wait after signaling otelcol-contrib shutdown or restart, silently dropping non-zero and signal exits. Now logged, with tests for both paths. go build, go vet, go test pass.
Issues
Closes #267
Summary by CodeRabbit
Bug Fixes
Tests