Skip to content

[Feature] Broker observability: status query command + stock metrics #659

Description

@pathosDev

Problem

BrokerActor.connectionState is protected (src/io/broker/BrokerActor.ts:432) — no other actor can ask a broker "are you connected?". So are subscriberCountForTopic and outboundBufferSize. The only channel is subscribing to BrokerConnected/BrokerDisconnected on the EventStream (src/io/broker/BrokerEvents.ts) and keeping your own copy.

And src/io/ has zero metric call sites: no broker_messages_published_total, no broker_reconnect_attempts_total, no buffer-depth gauge — even though BrokerBufferOverflow / BrokerReconnectAttempt events already fire at exactly the right places.

Proposed behaviour

Add a common { kind: 'status', replyTo } command handled by BrokerActor, returning { state, bufferSize, desiredSubscriptions, lastError }, and emit counters/gauges from the existing lifecycle hooks.

Acceptance criteria

  • /health can report broker connectivity without app code.
  • The Prometheus endpoint shows reconnect and publish counters.

Related: #467, #440

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions