Skip to content

Add production observability to zphp serve - #90

Open
TrixNEW wants to merge 11 commits into
nvms:mainfrom
TrixNEW:prod-observability
Open

TrixNEW wants to merge 11 commits into
nvms:mainfrom
TrixNEW:prod-observability

Conversation

@TrixNEW

@TrixNEW TrixNEW commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Closes #21

Adds optional production observability to zphp serve, including:

  • Separate admin listener with /health, /ready, and /metrics.
  • Prometheus metrics for requests, workers, memory, and uptime.
  • JSON server and access logs.
  • Request IDs across HTTP/1.1, HTTP/2, static files, and error responses.
  • Per-worker metrics with minimal overhead.

All features are opt-in, so default behavior remains unchanged. Added CLI options, documentation, and tests for logging, metrics, concurrency, shutdowns, and edge cases.

Testing

  • zig build test passed.
  • 197 tests passed on Linux, 196 on Windows.
  • Stress tests passed with no observed resource leaks.

Performance

  • All features disabled: +0.01% instructions per request.
  • Metrics enabled: +0.08%.
  • Access logging enabled: +1.25%.
  • WordPress benchmarks showed no meaningful regression.

Also found an existing HTTP/1.1 keep-alive performance issue related to TCP_NODELAY. Left it out of this PR to keep changes focused.

@TrixNEW

TrixNEW commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

Ready for merge

This branch has not been deployed

No deployments
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.

Add production observability

1 participant