Skip to content

Add /available endpoint to trac-gateway#696

Open
fintrac-alex-hewson wants to merge 3 commits into
mainfrom
feature/gateway-available-endpoint
Open

Add /available endpoint to trac-gateway#696
fintrac-alex-hewson wants to merge 3 commits into
mainfrom
feature/gateway-available-endpoint

Conversation

@fintrac-alex-hewson

@fintrac-alex-hewson fintrac-alex-hewson commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a new `/availablez` endpoint to the gateway that reports the availability of each configured backend service. No authentication is required to call it.

Behaviour

  • Probes each enabled backend service (metadata, data, orchestrator, admin) by attempting a TCP connection
  • Returns plain text, one line per service:
    metadata=yes
    data=yes
    orchestrator=no
    
  • Probes run in parallel; 2-second per-service connect timeout, 5-second total timeout
  • Only services configured and enabled in `PlatformConfig` are included in the output

Implementation

  • `AvailabilityHandler` (new) — `ChannelInboundHandlerAdapter` following the same internal-route pattern as `HealthCheckHandler`; receives `PlatformConfig` to resolve service addresses via `RoutingUtils`
  • `RouteBuilder` — registers `/available` as an `INTERNAL` route (GET only), consistent with `/healthz`
  • `InternalProxyBuilder` — wires `AvailabilityHandler` for the `available` protocol; receives `PlatformConfig` to pass through
  • `Http1Router` — carries `PlatformConfig` to pass to `InternalProxyBuilder`
  • `TracPlatformGateway` — stores `platformConfig` as an instance field and passes it when constructing `Http1Router`

Test plan

  • CI build passes
  • Call `GET /available` with no auth — returns `200 OK` with plain-text body listing services
  • With all services running, all lines show `=yes`
  • With a service stopped, its line shows `=no` and the response still arrives within the timeout

Adds a new /available endpoint to the gateway that probes each configured
backend service via TCP and returns a plain-text response with one line per
service: <service-key>=yes|no. No authentication is required.

Probes run in parallel with a 2-second per-service timeout (5-second total).
Return 403 Forbidden for requests not originating from loopback address.
The remote address is threaded from Http1Router through InternalProxyBuilder
to AvailabilityHandler, where InetAddress.isLoopbackAddress() covers both
IPv4 (127.0.0.1) and IPv6 (::1).
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