Each probe publishes a message over Jetstream NATS and then waits to receive it through a subscription. By measuring the time taken for this process, you can monitor the status of your NATS cluster. At Snapp!, we use this to detect the status of our NATS clusters from the client perspective.
You can track the following metrics:
- Connection: A
prometheus.CounterVec
that counts disconnections and connections. - Latency: A
prometheus.Histogram
that measures the latency between publishing and subscribing. - SuccessCounter: A
prometheus.CounterVec
that counts successful publishes and consumes.
This setup helps ensure that your NATS clusters are functioning optimally and provides insights into any issues from the client side.