feat(volo-http): add CommonStats and ServerStats struct to record lifecycle timings#649
Open
Joshuahoky wants to merge 7 commits intocloudwego:mainfrom
Open
feat(volo-http): add CommonStats and ServerStats struct to record lifecycle timings#649Joshuahoky wants to merge 7 commits intocloudwego:mainfrom
Joshuahoky wants to merge 7 commits intocloudwego:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #649 +/- ##
==========================================
+ Coverage 44.84% 44.85% +0.01%
==========================================
Files 162 162
Lines 20078 20081 +3
==========================================
+ Hits 9003 9007 +4
+ Misses 11075 11074 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
shenyj3
previously approved these changes
Mar 23, 2026
shenyj3
reviewed
Apr 8, 2026
volo-http/src/server/mod.rs
Outdated
| cx.rpc_info_mut().set_config(service.config); | ||
| let span = service.span_provider.on_serve(&cx); | ||
| let resp = service | ||
| cx.stats.record_handle_start(); |
Collaborator
There was a problem hiding this comment.
这里应该不是 handle start,更像是 recv end,http request 已经收完了。
service.inner.call() 只是会走到 service 里,但是不代表已经开始进入业务逻辑了,中间还有 middleware、route、param extract 等。
真正的 handler start 要到 volo-http/src/server/handler.rs#L77 这里了。
volo-http/src/server/mod.rs
Outdated
| .instrument(span) | ||
| .await | ||
| .into_response(); | ||
| cx.stats.record_handle_finish(); |
Collaborator
There was a problem hiding this comment.
同上,这里是 send start 而不是 handle finish。
af2f51d to
7ca20c8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Volo-http currently lacks visibility into key HTTP lifecycle timings, such as:
Solution
Added ServerStats in volo-http/src/context/server.rs to store timestamps for:
Also instrumented the request handling flow to populate the ServerHandleStart / Finish fields of ServerStats