Skip to content

# Monitoring

The monitoring stack runs as a Docker Compose profile and provides metrics collection, visualization, and alerting.

## Starting the Stack

    docker compose --profile monitoring up -d

This starts Prometheus, Grafana, Alertmanager, cAdvisor, Node Exporter, Redis Exporter, and Gotify (for push notifications).

## Custom Metrics

The platform exposes 12 custom `cm_*` Prometheus metrics:

- API request rates and latencies
- BullMQ queue sizes (email, SMS, video scheduling)
- Active canvass sessions
- External service health gauges

## Grafana Dashboards

Three pre-configured dashboards auto-provisioned from `configs/grafana/`:

- API Performance — request rates, latencies, error rates
- Application Overview — queue sizes, active sessions, service health
- System Health — container resources, host metrics, Redis stats

## Alertmanager

Alert rules in `configs/prometheus/alerts.yml` cover:

- API downtime and high error rates
- Queue backlogs
- Service connectivity failures
- Resource utilization thresholds

## Admin Routes

- `/app/observability` — embedded Grafana dashboards, alert status, and service health (3 tabs)

## Direct Access

- Grafana: `localhost:3005` or `grafana.DOMAIN`
- Prometheus: `localhost:9090`
- Alertmanager: `localhost:9093`