Summary
A few infrastructure and correctness details will matter more as the service is deployed more widely: API status metrics are currently fragile, graceful shutdown is missing, and the metric/registry setup is tightly coupled to global state.
This issue tracks foundational cleanup that improves operability, testability, and production readiness.
Why this matters
- Incorrect HTTP status recording undermines observability.
- Lack of graceful shutdown can drop in-flight requests during deployments.
- Tightly coupled global metric registration makes testing and composition harder.
- Logging on the hot path can create unnecessary I/O overhead.
Goals
- Improve correctness of service-level observability.
- Make the service friendlier to orchestration environments.
- Improve internal structure for testing and future extension.
Suggested scope
- Fix status recording middleware.
- Add graceful shutdown behavior.
- Reduce per-request log verbosity on normal paths.
- Refactor metric registration away from hard-coded global defaults where practical.
Child issues
- Fix HTTP status recording in middleware.
- Add graceful shutdown and worker draining support.
- Rework metric registration for better testability and composition.
- Reduce hot-path request logging overhead.
Acceptance criteria
- Service-level request metrics accurately reflect response codes.
- The process shuts down cleanly during deploys and restarts.
- Tests can use isolated registries without global coupling.
Summary
A few infrastructure and correctness details will matter more as the service is deployed more widely: API status metrics are currently fragile, graceful shutdown is missing, and the metric/registry setup is tightly coupled to global state.
This issue tracks foundational cleanup that improves operability, testability, and production readiness.
Why this matters
Goals
Suggested scope
Child issues
Acceptance criteria