Skip to content

Latest commit

 

History

History
63 lines (48 loc) · 1.84 KB

streaming.md

File metadata and controls

63 lines (48 loc) · 1.84 KB

Prometheus Export support for NATS Streaming

Since 0.2.0 release of the NATS Prometheus Exporter, it is possible to have the exporter poll metrics from the NATS Streaming Server monitoring port:

$ docker run natsio/prometheus-nats-exporter:latest -h
...
  -channelz
    	Get streaming channel metrics.
  -serverz
    	Get streaming server metrics.
...

Once enabled, the exporter will make available the following metrics:

# Per Channel metrics
nss_chan_bytes_total
nss_chan_last_seq
nss_chan_msgs_total
nss_chan_subs_last_sent
nss_chan_subs_max_inflight
nss_chan_subs_pending_count

# Server Totals
nss_server_bytes_total
nss_server_channels
nss_server_clients
nss_server_msgs_total
nss_server_subscriptions

And example dashboard can be found here:

Example

Monitoring msgs/sec from a channel

sum(rate(nss_chan_msgs_total{channel="foo"}[5m])) by (channel) / 3

With this query you an find the rate of messages being delivered on the channel foo. Note that in this case we are using 3 since that is the size of the cluster.

msgs-per-sec

Monitoring pending count from channel

sum(rate(nss_chan_msgs_total{channel="foo"}[5m])) by (channel) / 3
sum(nss_chan_subs_pending_count{channel="foo"}) by (channel) / 3

You could combine queries from nss_chan_msgs_total and nss_chan_subs_pending_count to compare the rate of messages with the pending count to detect whether processing is getting behind:

combination