# Monitoring (https://unmissed.dev/docs/monitoring)

Set `METRICS_TOKEN` and point Prometheus at `/metrics`:

```yaml
scrape_configs:
  - job_name: unmissed
    scheme: https
    authorization:
      credentials: your-metrics-token
    static_configs:
      - targets: [hooks.example.com]
```

`/metrics` answers `404` until `METRICS_TOKEN` is set, and `401` to a wrong token.

| Metric | Labels | What it counts |
| --- | --- | --- |
| `unmissed_webhooks_received_total` | `source_id`, `outcome` | Webhooks received, by outcome: `accepted`, `rejected` or `duplicate` |
| `unmissed_delivery_attempts_total` | `destination_id`, `result` | Send attempts, by result: `success` or `failure` |
| `unmissed_deliveries_given_up_total` | `destination_id` | Webhooks that failed for 3 days |
| `unmissed_deliveries_waiting` | `destination_id` | Webhooks waiting to be sent |
| `unmissed_oldest_waiting_seconds` | `destination_id` | How long the oldest waiting webhook has waited |
| `unmissed_destination_down` | `destination_id` | `1` while a destination is down |
| `unmissed_source_info` | `source_id`, `source` | The name of each source |
| `unmissed_destination_info` | `destination_id`, `source_id`, `destination` | The host and port of each destination |

Alert on `unmissed_oldest_waiting_seconds` to hear about a backlog before it matters.

## Names in graphs [#names-in-graphs]

Series are labelled by id, so renaming a source doesn't break your graphs. Names come from `unmissed_source_info` and `unmissed_destination_info`:

```text
sum by (source) (rate(unmissed_webhooks_received_total[5m]) * on (job, instance, source_id) group_left (source) unmissed_source_info)
```