Skip to content

feat(health): /healthz + /readyz + gRPC health for container deploys#62

Merged
randomizedcoder merged 1 commit into
feat/listener-ip-ttlfrom
feat/health-endpoints
Jul 9, 2026
Merged

feat(health): /healthz + /readyz + gRPC health for container deploys#62
randomizedcoder merged 1 commit into
feat/listener-ip-ttlfrom
feat/health-endpoints

Conversation

@randomizedcoder

Copy link
Copy Markdown
Owner

Summary

Adds first-class liveness / readiness so xtcp2 is easy to run under Docker and Kubernetes.

Stacked on #61 (base = feat/listener-ip-ttl) to avoid conflicts in initPromHandler / grpc_server.go. GitHub will retarget this to main once #61 merges — review/merge #61 first.

What

  • pkg/health — a process-wide readiness flag + HTTP handlers, served on the existing metrics listener:
    • /healthz — liveness: 200 as soon as the server is up (k8s livenessProbe).
    • /readyz — readiness: 200 only after the daemon passes its DestinationReady + netlinkers-up gate (i.e. it's actually polling), 503 before that and during shutdown (k8s readinessProbe/startupProbe).
  • gRPC — registers the standard grpc.health.v1 service on the gRPC port, starting NOT_SERVING and flipping to SERVING on the same readiness condition (native k8s gRPC probes).
  • The poller flips readiness (x.setReady) the moment it passes the DestinationReady gate, and back on return; setReady drives the HTTP flag and the gRPC status together.
  • Bumps goVendorHash for the new google.golang.org/grpc/health import.

No new flags — the endpoints are always on, on the existing listeners.

Verification

go test ./pkg/health/          # /healthz always 200; /readyz 503->200 on SetReady
nix build .#xtcp2-s3parquet
nix build .#test-cmd-xtcp2
nix build .#test-go-flavor-s3parquet

Readiness reflects real daemon state (destination initialised + netlinkers started), so an orchestrator holds traffic/rollout until xtcp2 is genuinely collecting — not merely that the process is up.

🤖 Generated with Claude Code

…ploys

Adds first-class liveness/readiness for Docker/Kubernetes deployment.

- pkg/health: process-wide readiness flag + HTTP handlers. /healthz is
  liveness (200 once the server is up); /readyz is readiness (200 only after
  the daemon passes its DestinationReady + netlinkers-up gate, 503 otherwise
  and on shutdown). Registered on the existing metrics listener.
- gRPC: register the standard grpc.health.v1 service on the gRPC port,
  starting NOT_SERVING and flipping to SERVING on the same readiness
  condition (for native k8s gRPC probes).
- The poller flips readiness (x.setReady) once it passes the DestinationReady
  gate — the moment xtcp2 starts polling — and back on return; setReady drives
  both the HTTP flag and the gRPC status from one place.
- Bump goVendorHash for the new google.golang.org/grpc/health import.
- Tests: pkg/health handlers via httptest; docs/observability.md section.

No new flags — the endpoints are always on, on the existing listeners.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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