Skip to content

feat(metrics): server accept, read, service and write phases on /metrics - #541

Merged
casibbald merged 1 commit into
mainfrom
feat/server-op-timing
Nov 3, 2026
Merged

casibbald merged 1 commit into
mainfrom
feat/server-op-timing

Conversation

@casibbald

@casibbald casibbald commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Turns on may_minihttp's op-timing feature (microscaler/may_minihttp#16).

  • Phases, in op_duration_seconds{component="may_minihttp.server"}: accept_to_first_byte, read_parse, service, response_write, request_total.
  • Levels, in op_gauge: open_connections, accept_backlog, accept_backlog_limit (Linux; the last two from TCP_INFO on the listening socket at scrape time).

Both families go out through the microscaler_timing::render_prometheus call that /metrics already makes (#540).

They cover the time a client sees outside BRRTRouter's own timers: the accept queue and the request read before them, the response write after them. A load test showed small writes at 150-200 ms p95 at the client, against 10-60 ms of handler time and 0.1 ms of request queue. These metrics place the gap.

Change: one feature flag on the may_minihttp dependency, and the lockfile moved to the may_minihttp integration branch head. cargo test --lib passes and the disallowed-methods gate passes.


Note

Low Risk
Observability-only dependency feature and lockfile updates; no request routing or auth logic changes in the diff.

Overview
Enables op-timing on the may_minihttp git dependency so the HTTP server exposes accept/read/service/write timing and connection gauges through the existing microscaler-timing / /metrics pipeline (documented inline in Cargo.toml).

The lockfile pins a newer may_minihttp integration commit (adds libc and microscaler-timing there) and bumps microscaler-timing / macro crates on microscaler-observability main. Transitive windows-sys entries shift slightly (mostly 0.61.2 → 0.60.2); no application source changes in this diff.

Reviewed by Cursor Bugbot for commit addd9bf. Bugbot is set up for automated code reviews on this repo. Configure here.

Turns on may_minihttp's op-timing feature: the HTTP server records accept_to_first_byte, read_parse, service, response_write and request_total in op_duration_seconds{component="may_minihttp.server"} and open_connections, accept_backlog and accept_backlog_limit in op_gauge, rendered by the existing microscaler_timing::render_prometheus call on /metrics. They cover the time a client sees before BRRTRouter's own timers start (accept queue, request read) and after they stop (response write). may_minihttp moves to the integration branch head with the feature.
@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6281a003-58c1-4e10-9139-4a83ed1f413d
Commits

Reviewing files that changed from the base of the PR and between 6a90c6d and addd9bf.

Files ignored due to path filters: 1
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing: 1
  • Cargo.toml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T21:44:49.458650Z addd9bf PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cursor

cursor Bot commented Nov 3, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: a2f26b99-541d-42aa-83ba-0ccf12889d12)

@casibbald

Copy link
Copy Markdown
Contributor Author

Test note. cargo test --lib on ms02: 851 passed, 1 failed. The failure is net::tests::off_coroutine_resolve_uses_the_system_resolver_and_is_counted (added in #539), which resolves localhost with a 1 ms timeout and failed while ms02 was under load. It passed three times in a row run on its own, and this PR does not touch net.rs. The lockfile also moves microscaler-timing feb690d -> fd89b94, which adds the op_gauge API that may_minihttp's feature uses.

@casibbald
casibbald merged commit adbc752 into main Nov 3, 2026
35 of 36 checks passed
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.

1 participant