Skip to content

fix(grpc_servicer): handle vllm log forwarding on servicer side - #975

Merged
CatherineSue merged 2 commits into
mainfrom
fix/servicer-log-forwarding
Mar 30, 2026
Merged

CatherineSue merged 2 commits into
mainfrom
fix/servicer-log-forwarding

Conversation

@CatherineSue

@CatherineSue CatherineSue commented Mar 30, 2026 •

Copy link
Copy Markdown
Member

Description

Problem

vllm's grpc_server.py manually attaches the smg_grpc_servicer logger to the vllm logging hierarchy at module level. This means vllm has to know about and configure third-party loggers, which was flagged in vllm-project/vllm#38333 (comment).

Solution

Move the logger attachment into the smg_grpc_servicer.vllm subpackage __init__.py so it happens automatically when the servicer is imported. Also switch health_servicer.py from logging.getLogger to vllm.logger.init_logger for consistency with servicer.py.

Changes

  • grpc_servicer/smg_grpc_servicer/vllm/__init__.py: Attach the top-level smg_grpc_servicer logger to the vllm logging hierarchy on import.
  • grpc_servicer/smg_grpc_servicer/vllm/health_servicer.py: Use vllm.logger.init_logger instead of logging.getLogger.

Test Plan

  • Start vLLM with --grpc and send requests
  • Verify servicer INFO messages (e.g. Generate request ...) still appear with vLLM's log format
  • Verify health check log messages also use vLLM's format
Checklist
  • cargo +nightly fmt passes
  • cargo clippy --all-targets --all-features -- -D warnings passes
  • (Optional) Documentation updated
  • (Optional) Please join us on Slack #sig-smg to discuss, review, and merge PRs

Summary by CodeRabbit

  • Chores
    • Synchronized logging configuration so package logs use the same handlers and log level as the vllm service, ensuring consistent formatting and output across components.
    • Aligned the health-check service logger with vllm's logging setup to improve observability and unify log behavior.

Attach the smg_grpc_servicer parent logger to the vllm logging
hierarchy in the vllm subpackage __init__, so vllm's grpc_server
no longer needs to configure it. Also switch health_servicer to
use vllm's init_logger for consistency with servicer.py.

Signed-off-by: Chang Su <chang.s.su@oracle.com>
@coderabbitai

coderabbitai Bot commented Mar 30, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Centralized logging setup added: the package logger for smg_grpc_servicer is reconfigured to mirror vllm logger handlers and level; propagation disabled. One health servicer now initializes its logger via vllm.logger.init_logger(__name__) instead of logging.getLogger(__name__).

Changes

Cohort / File(s) Summary
Logging configuration setup
grpc_servicer/smg_grpc_servicer/vllm/__init__.py
Adds logging import and copies vllm logger handlers and level to the smg_grpc_servicer package logger, and sets propagate = False.
Logger initialization update
grpc_servicer/smg_grpc_servicer/vllm/health_servicer.py
Replaces logging.getLogger(__name__) with vllm.logger.init_logger(__name__) for the module logger.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • slin1237

Poem

🐇 Hop by hop, I checked the log trace,
Handlers aligned in a cozy place.
vllm whispers, package obeys,
Quiet, tidy log-filled days.
🎉

🚥 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 'fix(grpc_servicer): handle vllm log forwarding on servicer side' directly and clearly describes the main change: implementing vLLM log forwarding configuration on the servicer side rather than in vLLM itself.
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/servicer-log-forwarding

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request integrates the smg_grpc_servicer logging with the vllm logging hierarchy and updates the health servicer to use vllm.logger.init_logger. A suggestion was made to copy the logger handlers instead of referencing them directly to avoid unintended side effects from future modifications to the shared handler list.

Comment thread grpc_servicer/smg_grpc_servicer/vllm/__init__.py Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@grpc_servicer/smg_grpc_servicer/vllm/__init__.py`:
- Around line 11-15: The current logger setup aliases _pkg_logger.handlers to
_vllm_logger.handlers and unconditionally sets _pkg_logger.propagate = False;
instead, copy _vllm_logger.handlers into _pkg_logger.handlers (so changes to
vllm handlers later don't affect our logger) and only disable propagation when
there are handlers present on _pkg_logger (i.e., set propagate=False if the
copied handlers list is non-empty, otherwise leave propagation unchanged) —
update the initialization that references _vllm_logger and _pkg_logger to
perform a shallow copy of handlers and a conditional propagate assignment.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: 458bc0f1-e452-4604-b4c2-60e0704334eb

📥 Commits

Reviewing files that changed from the base of the PR and between b8a8be9 and 750d9ca.

📒 Files selected for processing (2)
  • grpc_servicer/smg_grpc_servicer/vllm/__init__.py
  • grpc_servicer/smg_grpc_servicer/vllm/health_servicer.py

Comment thread grpc_servicer/smg_grpc_servicer/vllm/__init__.py
Signed-off-by: Chang Su <chang.s.su@oracle.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
grpc_servicer/smg_grpc_servicer/vllm/__init__.py (1)

15-15: ⚠️ Potential issue | 🟠 Major

Guard propagate based on handler availability.

_pkg_logger.propagate = False is still unconditional. If vllm has zero handlers at import time, smg_grpc_servicer logs can be suppressed. Set propagate to False only when copied handlers are present.

Suggested fix
 _pkg_logger.handlers = list(_vllm_logger.handlers)
 _pkg_logger.setLevel(_vllm_logger.level)
-_pkg_logger.propagate = False
+if _pkg_logger.handlers:
+    _pkg_logger.propagate = False
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@grpc_servicer/smg_grpc_servicer/vllm/__init__.py` at line 15, The package
logger currently unconditionally sets _pkg_logger.propagate = False which can
suppress host app logs if vllm has no handlers; change the logic in
vllm/__init__.py where _pkg_logger handlers are copied so that you only set
_pkg_logger.propagate = False when there are copied/attached handlers (e.g.,
check if _pkg_logger.handlers or the list returned by copy of handlers is
non-empty) and leave propagate True otherwise; update the block that copies
handlers and the propagate assignment (referencing _pkg_logger and the
handler-copying code) so propagate is conditional on handlers being present.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@grpc_servicer/smg_grpc_servicer/vllm/__init__.py`:
- Line 15: The package logger currently unconditionally sets
_pkg_logger.propagate = False which can suppress host app logs if vllm has no
handlers; change the logic in vllm/__init__.py where _pkg_logger handlers are
copied so that you only set _pkg_logger.propagate = False when there are
copied/attached handlers (e.g., check if _pkg_logger.handlers or the list
returned by copy of handlers is non-empty) and leave propagate True otherwise;
update the block that copies handlers and the propagate assignment (referencing
_pkg_logger and the handler-copying code) so propagate is conditional on
handlers being present.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e4b058ff-98f8-418f-93fa-436a6f29b599

📥 Commits

Reviewing files that changed from the base of the PR and between 750d9ca and 82fbaf2.

📒 Files selected for processing (1)
  • grpc_servicer/smg_grpc_servicer/vllm/__init__.py

@CatherineSue
CatherineSue merged commit eec8c5a into main Mar 30, 2026
29 checks passed
@CatherineSue
CatherineSue deleted the fix/servicer-log-forwarding branch March 30, 2026 18:19
smfirmin pushed a commit to smfirmin/smg that referenced this pull request Apr 2, 2026
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.

1 participant