mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-05 15:08:24 +00:00
Production exposes ngit_websocket_connection_duration_seconds, but after thousands of observed connection closures every bucket, the sum, and the count remained zero. The timer implementation existed but no request path ever constructed it. Create the timer only after a WebSocket upgrade succeeds and retain it for the full relay connection future. Its drop therefore observes every normally returned or errored established session, while failed HTTP upgrades remain excluded. This changes metrics wiring only; connection admission, protocol handling, and timeout behavior are deliberately unchanged. A real-socket integration scenario closes one established WebSocket and polls the metrics endpoint until exactly one duration observation appears. Validated with cargo test --test websocket_metrics (45 passed), cargo test --lib (650 passed), git diff --check, and nix build .#ngit-grasp.