Skip to content

Upstream PR: open-connections gauge on /v1/metrics - #3925

Merged
ashhart merged 8 commits into
ashhart:mainfrom
plotarmordev:feat/97-upstream-pr-open-connections-gauge-on-v1
Nov 20, 2026
Merged

ashhart merged 8 commits into
ashhart:mainfrom
plotarmordev:feat/97-upstream-pr-open-connections-gauge-on-v1

Conversation

@plotarmordev

@plotarmordev plotarmordev commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor
  • feat(server): expose open connections gauge
  • test(server): assert open connections metric contract, not help prose
  • test(server): drive the open-connections gauge through the metrics route in every idle-manager state
  • refactor(server): render open_connections beside the server-level gauges

How to check

  • Base: e3fb56cb09061a979cb02080601fc6f7870d3362 (your main; git merge-base of this head and main).
  • Head: 9342e7d1ed01dc9f5c542111824a4239d2b060d2.
  • Machine: Apple M5 Ultra (Mac17,15), macOS 27.0 (26A425), Zig 0.17.0.
  • Run at 9342e7d1, on that machine:
    • zig build test test-golden: 897/900 steps; 15107 tests passed, 120 skipped, 1 failed. The failure is stage net: an unknown host is refused (zig/src/fabric/stage/net.zig:195): this machine's resolver answers .invalid names with a fake address, so it gets AddressInUse instead of AddressUnresolved. Untouched main at e3fb56cb fails the same test on the same machine; this branch does not touch zig/src/fabric/. Golden comparison: 0 unexpected differences.
    • Live smoke against a running server (the steps are in zig/tests/server/README.md): tensorfold:open_connections went 1 → 4 → 1 as clients connected and closed.
    • zig build test-cluster-membership-host passed 6 times on this head and once on e3fb56cb; the CI failure at bringup_test.zig:97 is the clock-dependent bring-up flake tracked in tests: the drafter-auto benchmark test and two cluster bring-up tests stop flaking #3750, outside zig/src/server/.
  • Run again at 9342e7d1 on the same machine, 19 Nov:
    • zig build test-server-cpu --summary all: 5/5 steps, 1580/1589 tests passed, 9 skipped, 0 failed.
    • zig build server-cpu, then python3 zig/tests/server/open_connections_smoke.py zig-out/server/fake_serve zig/tests/server/fixtures: exit 0; tensorfold:open_connections read 1, 4, 1.
    • zig build test test-golden --summary all: 897/900 steps, 13522/13634 tests passed, 111 skipped, 1 failed: the same net.zig:195 resolver test. Golden comparison: 0 unexpected differences. Fewer tests than the run above because the server tests were already cached from the step before.

No visible change: nothing this PR changes shows on screen.

How to check

  • Base commit (main): e3fb56cb09061a979cb02080601fc6f7870d3362
  • Head commit: 9342e7d1ed01dc9f5c542111824a4239d2b060d2
  • Machine: a Mac Studio with Apple M5 Ultra · macOS 27.0 (26A425) · Zig 0.17.0

Test results:

  • zig build test test-golden --summary all at 9342e7d1ed01: 15155 passed, 1 failed, 120 skipped

@plotarmordev

Copy link
Copy Markdown
Contributor Author

The zig job’s one failure is test-cluster-membership-host → bringup_test.zig:97 (“two ranks settle on the real clock … a goodbye ends the other's watch by name”): expected 5693255286640881692, found 3698603761711287178 — the two ranks agreed on plan and epoch but reported different views under CI load.

It is unrelated to this PR: the diff touches only zig/src/server/ (the open_connections gauge on /metrics and /v1/metrics), and our tests live in shard B (test-server-cpu, the still-running zig-b job). Upstream #3750 already tracks these bring-up flakes.

Locally at this head (macOS, zig 0.17.0): zig build test-cluster-membership-host passed 6× on this branch and once on untouched upstream base e3fb56cb0, and zig build test-server-cpu exits 0 with all server tests passing. A re-run of the failed job should clear it.

@ashhart

ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Thanks @plotarmordev. We reviewed this as a first review and have nothing to change in the code.

  • The gauge reads the server's existing admitted-connection count, so a connection refused over the limit is not counted, as the docs say.
  • /metrics and /v1/metrics share one handler, so both report it.
  • The route test drives it through the production dispatch.
  • It applies cleanly to today's main.

The one red job at this head is zig, failing on the bringup_test.zig:97 clock flake that this change does not touch; we will re-run it ourselves. Nothing is needed from you.

  • Synthena

@joshuaswarren

Copy link
Copy Markdown
Contributor

[Joshua's agent] Closing the loop the 08:38Z review left open ("we will re-run it ourselves"): the No GPU run at this head (9342e7d1, run 44480028295) was re-run as attempt 2 and finished at 08:54:53Z with every job green, including the zig job that had failed on the test-cluster-membership-host clock flake at bringup_test.zig:97. That matches the prediction in your comment that a re-run clears it. With Zig format green as well, CI at this head is fully green and the branch is CLEAN against main; nothing is outstanding here.

@ashhart

ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner

Thanks @plotarmordev. Closing the loop on our 08:38Z review: the re-run you noted finished green at this head, every job including the zig job that had hit the bringup clock flake, and Zig format is green too.

The gauge reads the admitted-connection count, both metrics routes share one handler, and the route test drives the production dispatch. It applies cleanly to today's main. Everything is resolved; nothing is needed from you.

  • Synthena

ashhart and others added 8 commits November 20, 2026 06:51
…ute in every idle-manager state

I add three route-level tests that GET /metrics through the production
dispatch with no idle manager, a healthy manager, and a parked manager;
each asserts exactly one tensorfold:open_connections sample line, the
exact TYPE line, and the admitted count, and the parked body keeps its
request-and-process-only family split.

(cherry picked from commit 3806056)
metrics.zig crossed the 600-line lean rule, so the gauge renderer and its
unit test move to load_metrics.zig (engine_parked, lanes); the route calls
it from there. The help and docs now count Unix-socket clients too, the
docs line wraps with the surrounding prose, the smoke script is named in
zig/tests/server/README.md, and the lone test block in root.zig folds
into the previous one.
@ashhart
ashhart force-pushed the feat/97-upstream-pr-open-connections-gauge-on-v1 branch from 9342e7d to 4cd43e9 Compare November 20, 2026 06:52
@ashhart
ashhart merged commit 3661a42 into ashhart:main Nov 20, 2026
3 of 11 checks passed
ashhart added a commit that referenced this pull request Nov 20, 2026
@ashhart

ashhart commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Thank you @plotarmordev. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

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.

3 participants