Here you can find a few examples of monitoring NATS Streaming channels:
sum(nss_chan_subs_pending_count{channel="foo"}) by (client_id)
In this case, 3
is the size of the quorum of NATS Streaming Server nodes. In case of a single instance backed by a relational database we would set it to 1
:
sum(rate(nss_chan_msgs_total{channel="foo"}[5m])) by (channel) / 3
Example of combining the rate of messages with the pending count to detect whether processing is getting behind:
sum(rate(nss_chan_msgs_total{channel="foo"}[5m])) by (channel) / 3
sum(nss_chan_subs_pending_count{channel="foo"}) by (channel) / 3