-
Notifications
You must be signed in to change notification settings - Fork 699
[Feature]Log Format Normalization and Trace Log Optimization #6370
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
base: develop
Are you sure you want to change the base?
Conversation
|
Thanks for your contribution! |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #6370 +/- ##
==========================================
Coverage ? 67.91%
==========================================
Files ? 391
Lines ? 52810
Branches ? 8228
==========================================
Hits ? 35864
Misses ? 14326
Partials ? 2620
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Jiang-Jia-Jun
left a comment
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.
在其它代码中使用日志工具的代码是否能简化,而不依赖复杂的配置
fastdeploy/worker/worker_process.py
Outdated
|
|
||
|
|
||
| logging.getLogger = _patched_getLogger | ||
|
|
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.
为何需要单在WorkerProcess里面有这么大段的日志处理代码?
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.
为何需要单在WorkerProcess里面有这么大段的日志处理代码?
因为worker使用的paddle的日志框架,为了解决 Paddle 框架日志格式和FD自有的日志格式不一致的问题,需要在import paddle之前进行拦截和格式注入
fastdeploy/worker/worker_process.py
Outdated
| stream_handler = logging.StreamHandler() | ||
| stream_handler.setFormatter(formatter) | ||
| pd_logger.addHandler(stream_handler) | ||
| pd_logger.propagate = False |
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.
看起来这部分操作处理与worker_process的主功能是无关的。能否移到log下去作为一个功能函数(并给出明确的说明什么要有这个函数的存在),同时在worker_process仅调用
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.
看起来这部分操作处理与worker_process的主功能是无关的。能否移到log下去作为一个功能函数(并给出明确的说明什么要有这个函数的存在),同时在worker_process仅调用
军哥你看现在可以吗,worker_processor开头那一大段注入放到和fastdeploy平级的tools文件夹下了(不能放在fastdeploy下,fastdeploy一导入就会引入paddle导致注入失效),tools文件夹下不可以的话,就得新建一个和fastdeploy平级的文件夹了(和fastdeploy平级的log文件夹不是必然存在的,而且是放日志文件的,有的用户已经养成习惯会定期删除这个文件夹,如果放在这里感觉有点怪)
b284f8d to
3edb394
Compare
3edb394 to
4852c37
Compare
4852c37 to
0a9887a
Compare
Motivation
Currently, the project utilizes highly fragmented logging formats. There are four primary log formats in use, which complicates unified log collection, parsing, and filtering:
1. Standard/Legacy Format
%(levelname)-8s %(asctime)s %(process)-5s %(filename)s[line:%(lineno)d] %(message)sINFO 2026-02-04 08:14:43,669 17777 serving_chat.py[line:697] release ...2. Trace/Custom Format
[%(asctime)s] [%(levelname)-8s] (%(filename)s:%(funcName)s:%(lineno)d) %(message)s[2026-02-04 08:03:57,914] [INFO ] (engine_client.py:add_requests:296) [thread=140074076656064] ...3. Uvicorn Access Format
[%(asctime)s] [%(process)d] [INFO] %(message)s[2026-02-04 08:03:57,914] [17777] [INFO] ...4. Colorlog Uvicorn Format
[%(log_color)s%(asctime)s] [%(levelname)+8s] %(reset)s - %(message)s%(reset)s[2026-02-04 08:03:57,914] [ INFO] - ...Furthermore, trace logs currently fail to capture the
trace_idreceived from upstream requests. This leads to a lack of correlation between upstream and downstream logs, making end-to-end request tracking difficult.Modifications
%(levelname)-8s %(asctime)s %(process)-5s %(filename)s[line:%(lineno)d] %(message)sto facilitate efficient log collection and parsing.Usage or Command
Accuracy Tests
Checklist
[FDConfig],[APIServer],[Engine],[Scheduler],[PD Disaggregation],[Executor],[Graph Optimization],[Speculative Decoding],[RL],[Models],[Quantization],[Loader],[OP],[KVCache],[DataProcessor],[BugFix],[Docs],[CI],[Optimization],[Feature],[Benchmark],[Others],[XPU],[HPU],[GCU],[DCU],[Iluvatar],[Metax]]pre-commitbefore commit.releasebranch, make sure the PR has been submitted to thedevelopbranch, then cherry-pick it to thereleasebranch with the[Cherry-Pick]PR tag.