-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[Log] Use a relative path in debug-level logs to distinguish files with identical names #23846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: zjy0516 <[email protected]>
There was a problem hiding this comment.
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 aims to improve debuggability by using relative paths in log messages, which is a great idea for clarifying file origins. However, the current implementation introduces a performance overhead by calculating relative paths for all log messages, even in non-debug mode. I've provided a suggestion to conditionally perform this logic based on the VLLM_LOGGING_LEVEL
, ensuring there's no performance impact in production environments.
Signed-off-by: zjy0516 <[email protected]>
Signed-off-by: zjy0516 <[email protected]>
I would vote for stripping the vllm prefix to reduce visual clutter. We should also think about what to do about long paths (I think some of the |
Yeah, I see your point. Those paths can get crazy long. I guess it's maybe okay when you're deep in debugging and need the full context, but for most other times, it's a lot of noise. |
@robertgshaw2-redhat Sorry to disturb you, do you have any advice on this? |
@ZJY0516 how about we limit to 1 top-level folder and 2 bottom-level folders for now:
For
Does that make sense? |
Maybe just 2 bottom-level folder is enough? |
I think the order of importance is last folder, first folder, second-to-last folder. So if you only want 2 do one bottom one top? |
But I would still do what I proposed (2 bottom 1 top) |
I agree with you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small nit, let me know once this is ready for full review (with my proposed approach)
Soon. I am a little busy today. Thanks a lot |
Signed-off-by: zjy0516 <[email protected]>
@ProExpertProg Now it's ready for full review |
vllm/logging_utils/formatter.py
Outdated
|
||
def format(self, record): | ||
|
||
def shrink_path(relpath: str) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this take Path as an argument and can you add a comment what this does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(it includes a property parts
)
vllm/logging_utils/formatter.py
Outdated
if parts and parts[0] == "vllm": | ||
parts = parts[1:] | ||
if parts and parts[0] == "v1": | ||
# If starts with 'v1', keep the first two and last two levels | ||
if len(parts) > 4: | ||
return "/".join(parts[:2] + ["..."] + parts[-2:]) | ||
else: | ||
return "/".join(parts) | ||
else: | ||
# Otherwise, keep the first and last two levels | ||
if len(parts) > 3: | ||
return "/".join([parts[0], "..."] + parts[-2:]) | ||
else: | ||
return "/".join(parts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could simplify this:
if parts and parts[0] == "vllm": | |
parts = parts[1:] | |
if parts and parts[0] == "v1": | |
# If starts with 'v1', keep the first two and last two levels | |
if len(parts) > 4: | |
return "/".join(parts[:2] + ["..."] + parts[-2:]) | |
else: | |
return "/".join(parts) | |
else: | |
# Otherwise, keep the first and last two levels | |
if len(parts) > 3: | |
return "/".join([parts[0], "..."] + parts[-2:]) | |
else: | |
return "/".join(parts) | |
new_parts = [] | |
if parts[0] == "vllm": | |
parts = parts[1:] | |
if parts[0] == "v1": | |
new_parts += parts[0:1] | |
parts = parts[1:] | |
if len(parts) > 3: | |
parts = [parts[0]] + ["..."] + parts[-2:] | |
new_parts += parts | |
return "/".join(new_parts) |
Signed-off-by: zjy0516 <[email protected]>
Fixed! Can you check if it's all good now? @ProExpertProg |
@ProExpertProg Please take a look whether this can be mered |
…th identical names (vllm-project#23846) Signed-off-by: zjy0516 <[email protected]>
…th identical names (vllm-project#23846) Signed-off-by: zjy0516 <[email protected]>
…th identical names (vllm-project#23846) Signed-off-by: zjy0516 <[email protected]> Signed-off-by: xuebwang-amd <[email protected]>
Purpose
In vLLM, several files share the same name—for example,
vllm/config/__init__.py
,vllm/plugins/__init__.py
, andvllm/platforms/__init__.py
. This can be confusing during debugging.I suggest we use relative paths to better distinguish between these files. One thing I'm unsure about is whether we should use
vllm/config/__init__.py
orconfig/__init__.py
.Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
for a new model.