Skip to content

feat(serve): log request latency and bytes, add X-Response-Time header - #48

Merged
alshdavid merged 3 commits into
mainfrom
agent/auto-flash/e1a7983c6c3d
Oct 19, 2026
Merged

alshdavid merged 3 commits into
mainfrom
agent/auto-flash/e1a7983c6c3d

Conversation

@alshdavid

Copy link
Copy Markdown
Collaborator

Summary

  • Every request now logs [status] path duration bytes instead of just [status] path.
  • Responses carry an X-Response-Time header (e.g. 626us, 1.24ms).
  • Proxied requests log the same latency/bytes so slow upstreams are visible.

The handler is split into handle (timing, header, log) and handle_request (routing), so all exit paths get measured without touching each branch.

Verification

  • cargo check, cargo clippy --all-targets -- -D warnings, cargo test, cargo xfmt --check pass.
  • Manual run: [200] /home.html 626us 284B and x-response-time: 626us in the response.

Fixes #36

alshdavid and others added 2 commits October 19, 2026 20:27
The handler wrapper returned BoxBody<HyperBytes, Infallible> without
importing Infallible, breaking build, lint and test. Match the rest of
the handler and the http1 server signature with std::io::Error.
@alshdavid
alshdavid merged commit f882a4d into main Oct 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add per-request latency / bytes to logs (or an X-Response-Time header)

1 participant