[XPU] add fetch req log#8070
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8070 +/- ##
==========================================
Coverage ? 67.50%
==========================================
Files ? 475
Lines ? 66885
Branches ? 10315
==========================================
Hits ? 45154
Misses ? 18860
Partials ? 2871
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
PaddlePaddle-bot
left a comment
There was a problem hiding this comment.
🤖 Paddle-CI-Agent | pr_review |
2026-06-23 18:56:43
📋 Review 摘要
PR 概述:新增 FD_PD_LOG_REQUEST 开关,在 PD 分离的 prefill 发送和 decode 接收路径打印请求日志。
变更范围:fastdeploy/engine/common_engine.py、fastdeploy/envs.py
影响面 Tag:[Engine] [PD Disaggregation]
问题
| 级别 | 文件 | 概述 |
|---|---|---|
| 🔴 安全 | fastdeploy/engine/common_engine.py:985 |
prefill 连续资源分支将完整用户请求写入 INFO 日志 |
| 🔴 安全 | fastdeploy/engine/common_engine.py:1017 |
prefill 非连续资源分支将完整用户请求写入 INFO 日志 |
| 🔴 安全 | fastdeploy/engine/common_engine.py:2103 |
decode 接收分支将完整用户请求写入 INFO 日志 |
📝 PR 规范检查
标题当前使用 [XPU],但 diff 主要修改 PD 分离/Engine 请求日志;PR 描述仍是模板占位内容,未填写实际 Motivation/Modifications/Usage/Accuracy Tests。
标题建议(可直接复制):
[PD Disaggregation] Add gated PD request logging
PR 描述建议(点击展开,可直接复制)
## Motivation
需要在 PD disaggregation 场景下定位 prefill 和 decode 之间的请求传递问题,通过环境变量控制是否输出请求调试日志。
## Modifications
- 在 `fastdeploy/envs.py` 中新增 `FD_PD_LOG_REQUEST` 环境变量,默认关闭。
- 在 `fastdeploy/engine/common_engine.py` 的 prefill 发送请求和 decode 接收请求路径增加 PD 请求日志。
- 日志内容需脱敏为请求摘要,避免记录原始 prompt、messages、token ids 或多模态数据。
## Usage or Command
设置 `FD_PD_LOG_REQUEST=1` 可启用 PD 请求日志;默认 `0` 关闭。
## Accuracy Tests
N/A(仅新增日志开关和日志输出,不改变模型计算结果。)
## Checklist
- [x] Add at least a tag in the PR title.
- Tag list: [`[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]`]
- You can add new tags based on the PR content, but the semantics must be clear.
- [ ] Format your code, run `pre-commit` before commit.
- [ ] Add unit tests. Please write the reason in this PR if no unit tests.
- [x] Provide accuracy results.
- [x] If the current PR is submitting to the `release` branch, make sure the PR has been submitted to the `develop` branch, then cherry-pick it to the `release` branch with the `[Cherry-Pick]` PR tag.总体评价
新增开关默认关闭,但当前实现一旦开启会把完整用户请求内容落到 INFO 日志,存在敏感信息泄漏风险。建议先改为脱敏摘要日志后再合入。
| ) | ||
| task.metrics.ask_decode_resource_start_time = time.time() | ||
| if envs.FD_PD_LOG_REQUEST: | ||
| self.llm_logger.info(f"[PD_LOG] P sends Request: {task.to_dict()}") |
There was a problem hiding this comment.
🔴 安全 这里会把完整用户请求写入 INFO 日志。
Request.to_dict() 包含 prompt、prompt_token_ids、messages、system、history、tools、multimodal_data 等用户输入字段;一旦 FD_PD_LOG_REQUEST=1,PD 请求的原始内容会进入持久化日志,命中仓库 checklist 的日志泄漏项。
建议修复方式:
改为专用的脱敏/摘要结构,只输出 request_id、prompt_token_ids_len、idx、num_computed_tokens、必要的 block/resource 元数据;不要调用 task.to_dict() 直接落日志。
| ) | ||
| task.metrics.ask_decode_resource_start_time = time.time() | ||
| if envs.FD_PD_LOG_REQUEST: | ||
| self.llm_logger.info(f"[PD_LOG] P sends Request: {task.to_dict()}") |
There was a problem hiding this comment.
🔴 安全 这里会把完整用户请求写入 INFO 日志。
Request.to_dict() 包含 prompt、prompt_token_ids、messages、system、history、tools、multimodal_data 等用户输入字段;一旦 FD_PD_LOG_REQUEST=1,PD 请求的原始内容会进入持久化日志,命中仓库 checklist 的日志泄漏项。
建议修复方式:
改为专用的脱敏/摘要结构,只输出 request_id、prompt_token_ids_len、idx、num_computed_tokens、必要的 block/resource 元数据;不要调用 task.to_dict() 直接落日志。
| ) | ||
| for task in tasks: | ||
| if envs.FD_PD_LOG_REQUEST: | ||
| self.llm_logger.info(f"[PD_LOG] D received Request: {task.to_dict()}") |
There was a problem hiding this comment.
🔴 安全 这里会把完整用户请求写入 INFO 日志。
Request.to_dict() 包含 prompt、prompt_token_ids、messages、system、history、tools、multimodal_data 等用户输入字段;一旦 FD_PD_LOG_REQUEST=1,PD 请求的原始内容会进入持久化日志,命中仓库 checklist 的日志泄漏项。
建议修复方式:
改为专用的脱敏/摘要结构,只输出 request_id、prompt_token_ids_len、idx、num_computed_tokens、必要的 block/resource 元数据;不要调用 task.to_dict() 直接落日志。
CI报告基于以下代码生成(30分钟更新一次): 1 Required任务 : 8/10 通过
2 失败详情🔴 Run FastDeploy Unit Tests and Coverage / run_tests_with_coverage — PR问题(置信度: 高)错误类型: PR问题 | 置信度: 高
关键日志:
PR 新增了 修复建议:
关联变更: 🔴 Approval — 需要 Approval(置信度: 高)该 Job 需要人工 Approval,完成审批后 CI 才会继续执行。
修复建议:
关联变更: 无代码关联 |
Motivation
需要在 PD disaggregation 场景下定位 prefill 和 decode 之间的请求传递问题,通过环境变量控制是否输出请求调试日志。
Modifications
fastdeploy/envs.py中新增FD_PD_LOG_REQUEST环境变量,默认关闭。fastdeploy/engine/common_engine.py的 prefill 发送请求和 decode 接收请求路径增加 PD 请求日志。Usage or Command
设置
FD_PD_LOG_REQUEST=1可启用 PD 请求日志;默认0关闭。Accuracy Tests
N/A(仅新增日志开关和日志输出,不改变模型计算结果。)
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.