Skip to content

Server.Stats and godoc examples - #27

Merged
y001j merged 1 commit into
masterfrom
feat/stats
Nov 22, 2026
Merged

y001j merged 1 commit into
masterfrom
feat/stats

Conversation

@y001j

@y001j y001j commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Replaces #26, which GitHub closed when its base branch (release/v0.1.0) was deleted on merge.

  • Server.Stats() (roadmap item 17): open connections, accepted, accept errors, bytes read/written, idle/write timeouts, receive-buffer exhaustion (-ENOBUFS), backpressure pauses, zero-copy sends. Counters are plain fields updated on the loop thread (no cost on the data path); Stats collects them by posting to each loop.
  • example_test.go (roadmap item 22, part): pkg.go.dev examples — Listen with graceful shutdown, Conn.AsyncWrite from other goroutines, per-connection state and close reasons, publishing Stats with expvar.
  • README (EN/中文) Server table lists Stats.

Tested in the Lima VM (Linux 6.17): go test -race ./..., staticcheck.

🤖 Generated with Claude Code

Stats returns counters summed over the rings: open connections,
accepted, accept errors, bytes read/written, idle and write timeouts,
receive-buffer exhaustion (-ENOBUFS), backpressure pauses and zero-copy
sends. The counters are plain fields updated on the loop thread, so the
data path pays nothing; Stats reads them by posting to each loop.

example_test.go adds pkg.go.dev examples for Listen with graceful
shutdown, Conn.AsyncWrite from other goroutines, per-connection state
and close reasons, and publishing Stats with expvar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.56098% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 61.48%. Comparing base (70997cf) to head (edc6e38).

Files with missing lines Patch % Lines
stats.go 97.05% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #27      +/-   ##
==========================================
+ Coverage   60.17%   61.48%   +1.31%     
==========================================
  Files          18       19       +1     
  Lines        1052     1093      +41     
==========================================
+ Hits          633      672      +39     
- Misses        419      421       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@y001j
y001j merged commit 8fac316 into master Nov 22, 2026
6 checks passed
@y001j
y001j deleted the feat/stats branch November 22, 2026 12:15
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