Skip to content

Monitoring

Every Vesicle service exposes Prometheus metrics and health endpoints on a dedicated port. The chart can create the Prometheus Operator objects for them.

SourcePortPathChart setting
gateway, engine, worker, auth2112/metricsmetrics.addr (default :2112; empty disables it)
Health probes of the four services2112/livez, /readyzglobal.probes, <service>.probes
PostgreSQL (CloudNativePG)9187/metricsdatabase.cnpg.monitoring.enabled (default on)
NATS7777/metricsnats.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:

Terminal window
kubectl -n vss port-forward svc/vss-engine-metrics 2112:2112
curl -s localhost:2112/metrics | head
curl -s localhost:2112/readyz

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 on
database:
cnpg:
monitoring:
enabled: true
interval: 15s

Many Prometheus installs select monitors by a label (for example release: <name>). If nothing shows up in Prometheus, add that label with metrics.serviceMonitor.extraLabels.

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: true

The metric names stay in the standard gnatsd_* form. Watch JetStream storage and the consumer backlog: Vesicle keeps its durable queues and media in JetStream.

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.

All Vesicle series follow one rule:

vesicle_<domain>_<subject>[_<action>]_<unit-or-total>
  • The prefix is always vesicle_. Domains include client_, federation_, partial_state_, media_, nats_, presence_, login_, event_, room_ and streampos_.
  • 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_'.

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 ContinuousArchiving not being true and on a failed Backup.
  • 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.