📈Prometheus Metrics
soketi has a Prometheus exporter built-in with a list of metrics that can help you have a better overview of the cluster and connections. To get started, enable the feature in soketi via the METRICS_ENABLED
environment variable and set up your own Prometheus server to scrape the HTTP REST API of each node that soketi runs on.
soketi publicly exposes the WebSockets & HTTP REST API servers on port 6001
.
The metrics are served on port 9601
, which is not publicly exposed to the Internet by default so that the sensitive metrics will not require the complexity of an authentication system. Therefore, you may easily scrape the metrics from your private network or from the same server instance the soketi server runs on.
When configuring your firewalls, keep in mind that you should let users access port 6001
from the Internet (so that messages can be broadcast), but not port 9601
.
Enabling Metrics
You may use the the METRICS_ENABLED
environment variable to enable the metrics server.
A small sample of metrics output can be found below. The exposed metrics are for both soketi connections and apps, as well as the Node.js built-in Prometheus metrics regarding the running processes, memory, and CPU usage that can be useful for autoscaling or monitoring the running instance.
Prometheus Metrics Environment Variables
SOKETI_METRICS_ENABLED
false
true
, false
Whether to enable metrics. For Prometheus, enabling this option will expose a /metrics
endpoint.
SOKETI_METRICS_SERVER_PORT
9601
Any number
The metrics server port. For security, this port should not be exposed to the Internet.
SOKETI_METRICS_DRIVER
prometheus
prometheus
The driver used to scrape metrics. For now, only prometheus
is supported.
SOKETI_METRICS_PROMETHEUS_PREFIX
soketi_
Any string
The prefix to add to the metrics in Prometheus to differentiate from other metrics in Prometheus.
Last updated