Skip to content

EvictionController: Fix unused logger context return value#285

Open
notandy wants to merge 1 commit intomainfrom
fix/eviction-logger-context
Open

EvictionController: Fix unused logger context return value#285
notandy wants to merge 1 commit intomainfrom
fix/eviction-logger-context

Conversation

@notandy
Copy link
Copy Markdown
Contributor

@notandy notandy commented Apr 8, 2026

Assign the return value of logger.IntoContext() back to ctx so that subsequent calls using ctx will have the enriched logger with additional fields (server, server_status).

Summary by CodeRabbit

  • Bug Fixes
    • Fixed logging context propagation during eviction operations to ensure subsequent operations and log statements correctly maintain context information throughout the operation flow.

Assign the return value of logger.IntoContext() back to ctx so that
subsequent calls using ctx will have the enriched logger with
additional fields (server, server_status).
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 078fd388-c719-4645-94d0-5389a2617baf

📥 Commits

Reviewing files that changed from the base of the PR and between 499dcef and 817244e.

📒 Files selected for processing (1)
  • internal/controller/eviction_controller.go

📝 Walkthrough

Walkthrough

The logging context in the eviction controller was updated to properly assign the modified context returned by logger.IntoContext() back to the context variable in two locations. This ensures subsequent operations use the enriched logging context with proper scoping.

Changes

Cohort / File(s) Summary
Logging Context Assignment
internal/controller/eviction_controller.go
Fixed context propagation by assigning the updated context from logger.IntoContext(ctx, log) back to ctx in two places: upon entering evictNext with server UUID scoping and after enriching logs with server_status. Ensures OpenStack calls and log statements use the correct logging context.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A context was lost in the flow,
The logger's return didn't show,
Now ctx is assigned,
With logs realigned,
The server UUID will glow!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing unused logger context return values in the EvictionController by reassigning them to ctx.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/eviction-logger-context

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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller 63.27% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/eviction_controller.go 30.56% (ø) 144 44 100

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

@fwiesel fwiesel self-requested a review April 9, 2026 07:20
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.

2 participants