Skip to content

feat: accurate connection tracking via local port (#119)#120

Merged
cbaugus merged 4 commits intodevfrom
feat/accurate-connection-tracking
Apr 14, 2026
Merged

feat: accurate connection tracking via local port (#119)#120
cbaugus merged 4 commits intodevfrom
feat/accurate-connection-tracking

Conversation

@cbaugus
Copy link
Copy Markdown
Owner

@cbaugus cbaugus commented Apr 14, 2026

Summary

  • Replaces the unreliable latency-based heuristic (likely_new/likely_reused) with deterministic local TCP port tracking
  • Each response's local SocketAddr is extracted from hyper's HttpInfo — a new local port = new TCP connection, same port = reused
  • Removes metricsReuseThresholdMs YAML field (no longer needed)
  • Updates docs/CONNECTION_POOL.md with accurate metric names and Grafana queries

Breaking Metric Changes

Removed Replacement
connection_pool_likely_new_total connection_pool_new_total
connection_pool_likely_reused_total connection_pool_reused_total

connection_pool_reuse_rate_percent is kept but now uses accurate tracking.

Test plan

  • CI passes (build + tests)
  • Deploy dev build, run load test with default pooling — verify connection_pool_reused_total climbs
  • Run with pool: { maxIdlePerHost: 0, idleTimeoutSecs: 0 } — verify connection_pool_new_total climbs
  • Confirm Grafana dashboards work with new metric names

Closes #119

🤖 Generated with Claude Code

cbaugus and others added 4 commits April 13, 2026 20:08
#119)

Remove the unreliable latency-based heuristic (likely_new/likely_reused)
and replace with deterministic local TCP port tracking.  Each response's
local SocketAddr is extracted from hyper's HttpInfo — a new local port
means a new TCP connection, same port means reused.

Breaking metric changes:
  - Removed: connection_pool_likely_new_total
  - Removed: connection_pool_likely_reused_total
  - Added:   connection_pool_new_total
  - Added:   connection_pool_reused_total
  - connection_pool_reuse_rate_percent now uses accurate tracking
  - Removed: metricsReuseThresholdMs YAML field (no longer needed)

Closes #119

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests now use SocketAddr-based record_request() and the new
ConnectionStats fields (new_connections, reused_connections).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cbaugus cbaugus merged commit dcfc65a into dev Apr 14, 2026
4 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