Monitoring
Every Vesicle service exposes Prometheus metrics and health endpoints on a dedicated port. The chart can create the Prometheus Operator objects for them.
What is exposed
Section titled “What is exposed”| Source | Port | Path | Chart setting |
|---|---|---|---|
| gateway, engine, worker, auth | 2112 | /metrics | metrics.addr (default :2112; empty disables it) |
| Health probes of the four services | 2112 | /livez, /readyz | global.probes, <service>.probes |
| PostgreSQL (CloudNativePG) | 9187 | /metrics | database.cnpg.monitoring.enabled (default on) |
| NATS | 7777 | /metrics | nats.promExporter.enabled (default off) |
The metrics port is separate from the public ports, so nothing needs to be exposed through your ingress. The chart creates a ClusterIP Service <release>-<service>-metrics for each service.
Look at the raw output of one service:
kubectl -n vss port-forward svc/vss-engine-metrics 2112:2112curl -s localhost:2112/metrics | headcurl -s localhost:2112/readyzWith the Prometheus Operator
Section titled “With the Prometheus Operator”If the Prometheus Operator CRDs are installed (monitoring.coreos.com/v1), the chart renders:
- a ServiceMonitor per service (gateway, engine, worker, auth), scraping every 15 seconds;
- a PodMonitor for the database cluster.
Both are on by default and render only when the CRDs exist, so it is safe to leave them on. Tune them with:
metrics: serviceMonitor: enabled: true interval: 30s extraLabels: release: kube-prometheus-stack # the label your Prometheus selects ondatabase: cnpg: monitoring: enabled: true interval: 15sMany Prometheus installs select monitors by a label (for example release: <name>). If nothing shows up in Prometheus, add that label with metrics.serviceMonitor.extraLabels.
NATS metrics
Section titled “NATS metrics”The NATS exporter is off by default. Its PodMonitor does not check for the Operator CRDs, so turn both on only when the CRDs are installed:
nats: promExporter: enabled: true podMonitor: enabled: trueThe metric names stay in the standard gnatsd_* form. Watch JetStream storage and the consumer backlog: Vesicle keeps its durable queues and media in JetStream.
Without the Operator
Section titled “Without the Operator”Scrape the metrics Services with your own Prometheus configuration (Kubernetes service discovery on the <release>-<service>-metrics Services, port named metrics). Set metrics.serviceMonitor.enabled: false if you do not want the objects.
Metric names
Section titled “Metric names”All Vesicle series follow one rule:
vesicle_<domain>_<subject>[_<action>]_<unit-or-total>- The prefix is always
vesicle_. Domains includeclient_,federation_,partial_state_,media_,nats_,presence_,login_,event_,room_andstreampos_. - Counters end in
_total, durations in_duration_seconds. Gauges are plain nouns (_active,_queue,_pending). - Labels are low-cardinality (for example
result).
List what a running service exposes: curl -s localhost:2112/metrics | grep '^# TYPE vesicle_'.
What to alert on
Section titled “What to alert on”A starting point, in terms of what you can observe without Vesicle-specific knowledge:
- Readiness and restarts: pods not ready, or container restarts (kube-state-metrics).
- Database: CloudNativePG reports replication lag, instance availability and archiving status. Alert on
ContinuousArchivingnot being true and on a failedBackup. - NATS: JetStream storage use close to the PVC size, and growing consumer backlogs on the federation queues.
- Federation: a rising count of failed outbound or inbound federation requests (the
federation_metrics).
The health endpoints are what Kubernetes uses to restart a service. They are not a substitute for alerting.