Skip to content

richat: expose active subscriber count at /subscribers endpoint#206

Open
mindrunner wants to merge 1 commit into
lamports-dev:masterfrom
mindrunner:feat/subscribers-endpoint
Open

richat: expose active subscriber count at /subscribers endpoint#206
mindrunner wants to merge 1 commit into
lamports-dev:masterfrom
mindrunner:feat/subscribers-endpoint

Conversation

@mindrunner

Copy link
Copy Markdown
Collaborator

Add a new HTTP endpoint on the metrics server that returns the current count of active gRPC subscribers as a plain decimal string. Intended for an external load-balancer weighting loop that polls richat nodes and updates Cloudflare pool origin_weights via API, since CF DNS-only LB steering modes don't read health-check bodies to compute weights.

  • metrics/src/server.rs: add /subscribers route + get_subscribers callback parameter.
  • richat/src/metrics.rs: add GRPC_SUBSCRIBE_COUNT shared AtomicUsize and wire it into spawn_server.
  • richat/src/grpc/server.rs: increment/decrement alongside the existing grpc_subscribe_total gauge in SubscribeClientState::new()/Drop.
  • plugin-agave/src/metrics.rs: pass || 0 stub (not applicable).

Add a new HTTP endpoint on the metrics server that returns the current
count of active gRPC subscribers as a plain decimal string. Intended
for an external load-balancer weighting loop that polls richat nodes
and updates Cloudflare pool origin_weights via API, since CF DNS-only
LB steering modes don't read health-check bodies to compute weights.

- metrics/src/server.rs: add `/subscribers` route + `get_subscribers`
  callback parameter.
- richat/src/metrics.rs: add `GRPC_SUBSCRIBE_COUNT` shared AtomicUsize
  and wire it into `spawn_server`.
- richat/src/grpc/server.rs: increment/decrement alongside the existing
  `grpc_subscribe_total` gauge in `SubscribeClientState::new()`/`Drop`.
- plugin-agave/src/metrics.rs: pass `|| 0` stub (not applicable).
@mindrunner mindrunner requested a review from fanatid April 21, 2026 11:38
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