Server observability
To provide a better server observability Centrifugo supports reporting metrics in Prometheus format and can automatically export metrics to Graphite.
Metrics
Prometheus metrics
To enable Prometheus endpoint start Centrifugo with prometheus
option on:
{
...
"prometheus": true
}
This will enable /metrics
endpoint so the Centrifugo instance can be monitored by your Prometheus server.
Graphite metrics
To enable automatic export to Graphite (via TCP):
{
...
"graphite": true,
"graphite_host": "localhost",
"graphite_port": 2003
}
By default, stats will be aggregated over 10 seconds intervals inside Centrifugo and then pushed to Graphite over TCP connection.
If you need to change this aggregation interval use the graphite_interval
option (in seconds, default 10
).
Grafana dashboard
Check out Centrifugo official Grafana dashboard for Prometheus storage. You can import that dashboard to your Grafana, point to Prometheus storage – and enjoy visualized metrics.
Exposed metrics
Here is a description of various metrics exposed by Centrifugo.
centrifugo_node_messages_sent_count
- Type: Counter
- Labels: type
- Description: Tracks the number of messages sent by a node to the broker.
- Usage: Use this metric to monitor the outgoing message rate and detect any anomalies or spikes in the data flow.
centrifugo_node_messages_received_count
- Type: Counter
- Labels: type
- Description: Measures the number of messages received from the broker.
- Usage: Helps in understanding the incoming message rate and ensures the node is receiving data as expected.
centrifugo_node_action_count
- Type: Counter
- Labels: action
- Description: Counts the number of various actions called within the node.
- Usage: Useful for tracking specific actions' usage and frequency.
centrifugo_node_num_clients
- Type: Gauge
- Description: Shows the current number of clients connected to the node.
- Usage: Monitor the client connections to ensure the node is not reaching its capacity.
centrifugo_node_num_users
- Type: Gauge
- Description: Displays the number of unique users connected to the node.
- Usage: Helps in understanding user engagement and capacity planning.
centrifugo_node_num_subscriptions
- Type: Gauge
- Description: Indicates the number of active subscriptions.
- Usage: Use this to monitor the subscription levels and identify any potential issues or required optimizations.
centrifugo_node_num_nodes
- Type: Gauge
- Description: Shows the total number of nodes in the cluster.
- Usage: Essential for monitoring the size of the cluster and ensuring that all nodes are operational.
centrifugo_node_build
- Type: Gauge
- Labels: version
- Description: Provides build information of the node.
- Usage: Helps in tracking the version of the application running across different environments.
centrifugo_node_num_channels
- Type: Gauge
- Description: Counts the number of channels with one or more subscribers.
- Usage: Useful for monitoring the activity and utilization of channels.
centrifugo_node_survey_duration_seconds
- Type: Summary
- Labels: op
- Description: Captures the duration of surveys conducted by the node.
- Usage: Helps in performance monitoring and identifying any delays or issues in survey operations.
centrifugo_client_num_reply_errors
- Type: Counter
- Labels: method, code
- Description: Counts the number of errors in replies sent to clients.
- Usage: Critical for error monitoring and ensuring smooth client interactions.