Skip to content

Conversation

@juncaipeng
Copy link
Collaborator

@juncaipeng juncaipeng commented Dec 1, 2025

Motivation

增加时间戳,用于分析系统耗时。

Modifications

全流程打点。

Usage or Command

请求加上 collect_metrics=True 字段

Accuracy Tests

单侧覆盖

Checklist

  • 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.
  • Provide accuracy results.
  • 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.

Copilot AI review requested due to automatic review settings December 1, 2025 12:44
Copilot finished reviewing on behalf of juncaipeng December 1, 2025 12:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the request timing metrics infrastructure to support comprehensive performance analysis of splitwise (prefill/decode disaggregation) deployments. The changes centralize timing attributes from the Request class into a dedicated RequestMetrics dataclass, adding numerous timestamp fields to track the full lifecycle of requests across prefill and decode nodes.

Key Changes

  • Introduced a comprehensive RequestMetrics dataclass with 20+ timestamp fields tracking request flow through the system
  • Migrated timing attributes from Request class to the new metrics object
  • Added timestamp recording at critical points: scheduler receipt, resource allocation, prefill/decode handoff, and token generation
  • Changed default value of FD_ENABLE_CACHE_TASK from enabled to disabled

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
fastdeploy/engine/request.py Added RequestMetrics dataclass with comprehensive timestamp fields and helper methods; removed timing attributes from Request class
fastdeploy/output/token_processor.py Refactored to use metrics object instead of direct timing attributes; updated token processing to record timing via metrics methods
fastdeploy/engine/engine.py Updated to record preprocess timing in metrics object
fastdeploy/engine/async_llm.py Updated request preprocessing to use metrics.preprocess_start_time
fastdeploy/engine/common_engine.py Added timestamp recording at key lifecycle points (engine_get_req_time, ask_decode_resource times, inference_start_time); updated comment to correctly indicate v0 scheduler usage
fastdeploy/engine/sched/resource_manager_v1.py Removed direct inference_start_time assignments; added metrics propagation for decode scenarios
fastdeploy/engine/resource_manager.py Removed direct inference_start_time assignment during resource allocation
fastdeploy/entrypoints/openai/protocol.py Added metrics field to ChatCompletionStreamResponse
fastdeploy/entrypoints/openai/serving_chat.py Updated to include metrics in streaming response chunks
fastdeploy/envs.py Changed FD_ENABLE_CACHE_TASK default from "1" to "0"

@paddle-bot
Copy link

paddle-bot bot commented Dec 1, 2025

Thanks for your contribution!

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 38.29787% with 87 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@69e003a). Learn more about missing BASE report.

Files with missing lines Patch % Lines
fastdeploy/engine/request.py 53.12% 28 Missing and 2 partials ⚠️
fastdeploy/engine/common_engine.py 0.00% 28 Missing ⚠️
fastdeploy/output/token_processor.py 27.58% 21 Missing ⚠️
fastdeploy/engine/sched/resource_manager_v1.py 0.00% 4 Missing ⚠️
fastdeploy/entrypoints/openai/serving_chat.py 60.00% 1 Missing and 1 partial ⚠️
fastdeploy/scheduler/splitwise_scheduler.py 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #5317   +/-   ##
==========================================
  Coverage           ?   58.90%           
==========================================
  Files              ?      324           
  Lines              ?    40144           
  Branches           ?     6062           
==========================================
  Hits               ?    23648           
  Misses             ?    14623           
  Partials           ?     1873           
Flag Coverage Δ
GPU 58.90% <38.29%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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