Beacon telemetry map
Beacon is the incident manager and status page of Frappe Cloud V2. Each product sends its telemetry to the Datum of its region. Beacon reads Datum, matches each row to a resource, and turns failing rows into alerts, incidents and pages. This page shows what each product sends, how Beacon maps it, the services and their SLOs, and the 59 alert rules (Atlas 32, Cargo 15, Central 7, Pilot 5).
How it fits
The problem: many products send data, but an alert must name one resource that a person can fix. So every product sends with one ID for each machine, and the resource sources list the same IDs.
- A producer collects a value and sends it to the Datum of its region with a token. The token holds the resource ID.
- Datum validates the request and writes the rows to ClickHouse. Materialized views copy new samples to
samples_recent(2 days) and machine metrics tosamples_5m(90 days). - Each minute, Beacon reads the resource list of each region from Atlas. It keeps the resources, their parents and their status.
- Beacon runs each rule and each SLI on ClickHouse as the select-only
beaconuser. It keeps a row only when itsresource_idis a known, checked resource of a type that the rule names, and monitoring is on for it. - Beacon turns rows into alerts, alerts into incidents, and incidents into pages and chat posts. A person decides what the status page shows.
Resource map
Beacon matches a rule row by its resource_id only. There is no second ID. The resource_type line of a rule names the registry types of its rows, and Beacon drops a row of any other type. A query can leave out the resources with monitoring disabled with {excluded:Array(String)}. So the important rule is: the ID that a machine sends must be the ID that Atlas lists. Every machine uses its Atlas name.
| Group | Resource | Beacon type | resource_id | Parent | Listed by | Sends telemetry as this ID |
|---|---|---|---|---|---|---|
| Region | The region | Region | The region name | None | Beacon | Nobody. Rules for Datum, Central and fleet-wide checks alert on it. |
| Control plane | Atlas | Atlas | atlas | None | Atlas | The Atlas site: inventory, jobs, API, Error Logs, BMC readings |
| Hardware | Host | Metal Host | The Metal Server name | None | Atlas | metald (metrics) and the Datum agent (logs only) |
| Virtual machines | Service VM (proxy, WireGuard, IPv6 router) | Virtual Machine | The Atlas VM name, vm-<tenant>-NNNN | Its host | Atlas | The Datum agent |
| Cargo VM and Cargo machines (Garage, gateway, Datum host) | Virtual Machine | The Atlas VM name | Its host | Atlas | The Datum agent. Cargo signs the token of each Cargo machine. Atlas signs the token of the Datum agent on the Cargo VM. | |
| Customer server (Pilot) | Virtual Machine | The Atlas VM name | Its host | Atlas | Pilot. Central signs the token with the atlas_vm_id of the server. Cargo signs it for the Pilot of the Cargo VM. | |
| Service nodes | Proxy, WireGuard gateway, IPv6 router | Proxy Server, Wireguard Gateway Server, IPv6 Router Server | The node name | Its VM | Atlas | Nobody directly. The VM sends, and a rule maps the VM to its node with atlas_service_node. |
| Object storage and builds | Cargo | Cargo Server | cargo | The Cargo VM | Atlas | The Cargo site, with a token that Cargo signs. The Object Storage SLI also reports as cargo. |
| Global | Central | No resource | central in Datum | Nobody | Central. Its rules and SLIs return the region as resource_id, so they need no resource. | |
| Not covered | Grove box | No resource | grove:<machine> | Nobody | Grove. Beacon drops any rule row for it. See Gaps. |
Who signs the token
Only the token binds a row to a resource. The sender chooses the metric, the labels and the message, so a rule must read only the rows of its own sender. Datum verifies each token against one key set for the region. A key ID names its issuer, and iss must match it.
| Issuer | Key ID | Signs for |
|---|---|---|
| Central | central: | central, and each customer server (Pilot) |
| Atlas | atlas:<region id>: | atlas, the hosts (metald), the service VMs and the Datum agent of the Cargo VM |
| Cargo | cargo:<region id>: | cargo, the Pilot of the Cargo VM, and the Garage and Datum host machines |
Datum takes central, atlas and cargo only from a token of that product, so a machine cannot write as one of them. Cargo serves the key set that the Datum host reads: the Atlas set, which holds the Central keys, and the Cargo key. A Cargo machine keeps a machine token in its Atlas metadata and trades it at Cargo each day for a Datum token of 7 days. Cargo refuses it when the Machine is not Running.
Status in Beacon
Only an Active resource is checked. A new or reactivated resource is not checked for 10 minutes, so it can finish booting.
| Resource | Active | Pending | Suspended | Terminated |
|---|---|---|---|---|
| VM | Placed and not sleeping. A crashed VM stays Active, so it keeps its alerts. | A draft | Stopped to sleep | Terminating |
| Host | Active | Provisioning | Failed | Archived |
| Service node, Cargo | Active | Being set up | Failed | Archived |
Parents and incident scope
A resource has a path, such as host, VM, proxy node. An alert joins an open incident whose scope covers it or a parent. A rule with scope_includes_descendants, such as a host that is down, opens an incident that covers everything under the host. So the VM and Pilot alerts that follow join that incident and do not page again. An incident of a resource with a parent waits 90 seconds before it pages, so the incident of the parent can take the alert first.
Services and SLOs
A service measures what customers feel. Each minute, Beacon runs the SLI query of each service in each region and stores good and valid counts. The SLO is the target over 30 days. A fast burn of the error budget pages.
| Service | Owner | Good means | SLO | How it counts |
|---|---|---|---|---|
| Sites | Pilot | Sites answer requests on the servers that run them. | 99.9% | sort_order: 1 Pilot pings /api/method/ping on each site once a minute and sends pilot_sites by state. App request hooks run on the ping, so an app fault can count as bad. A sample more than 1 minute in the future comes from a wrong clock, and must not stay the newest value. |
| Servers | Atlas | Servers that should run are available. | 99.9% | sort_order: 2 |
| Networking | Atlas | The proxies pass requests to sites without errors of their own. | 99.9% | sort_order: 3 A proxy error is a 5xx that the proxy made itself (origin proxy). A 5xx from the site's own code is good here. |
| Object Storage | Cargo | S3 requests to object storage succeed. | 99.9% | sort_order: 4 A 5xx answer is bad. 403 and 404 are normal S3 answers, so they are good. The Garage nodes send with their own resource IDs, but the resource list has one resource for Cargo, so the query reports the object storage of the region as the one reporter 'cargo'. The window is 3 minutes, so a counter that the Datum agent scrapes each minute has the 2 samples that an increase needs. |
| Dashboard and API | Central | Requests to the Central dashboard and API succeed. | 99.9% | Central requests that do not fail with 5xx, the mean of 5 minutes. A 4xx is good. The reporter is the region, because Central is in no resource list. Desk sets its Query Region. |
| Server actions | Central | Customer actions on servers and sites finish without an error. | 99% | Create, start, stop, restart and resize actions that succeed, from the last-hour count. Failed and Timed Out are bad. Terminate does not count. A burn does not page: central-resource-actions pages on the same failures. |
Burn alerts
| Alert key | Budget used | Long window | Short window | Burn rate | Severity |
|---|---|---|---|---|---|
fast | 2% | 1 hour | 5 minutes | 14.4 | High, pages |
medium | 5% | 6 hours | 30 minutes | 6 | High, pages |
slow | 10% | 3 days | 6 hours | 1 | Low |
sla | 1 hour | 15 minutes | The SLA error rate | High, pages |
A window with fewer than 100 valid events does not alert. When the query fails or returns no valid events, the service is Unknown, not good.
Severity: what happens
| Severity | Means | Chat | Phone call | Next responder after | When nobody answers | |
|---|---|---|---|---|---|---|
| Critical | Customers are down now. A person must act at once. | Yes | Yes | Yes | 2 minutes | Calls continue until a person acknowledges. A postmortem is required. |
| High | Customers are or will soon be affected. | Yes | Yes | Yes | 5 minutes | Stops after 3 rounds and posts to chat |
| Medium | A person must look today. | Yes | Yes | No | ||
| Low | Something to know about. | Yes | No | No |
- A responder acknowledges a call by pressing 1. An incident has one severity: the highest of its alerts.
- When ClickHouse of a region fails 2 probes, Beacon raises one Critical "Region unreachable" alert, skips the rules of the region, and shows its services as Unknown.
- A rule query error never resolves an alert. Beacon never publishes an incident. A person decides what customers see.
- If Beacon stops, its external heartbeat stops, and the heartbeat service calls the team.
- A postmortem is required for an incident that is public or Critical, that took more than 1 hour, or that a customer found first.
Endpoint checks
All other signals come from inside a region. An endpoint check calls a URL or a host from the Beacon site, so it sees what a customer sees. It runs each minute in the region run, and raises or resolves an alert on the region resource.
| Kind | File | Fails when |
|---|---|---|
| HTTP | beacon/rules/<key>.http | The request fails, the status is not the expected status (200 by default), or the body does not contain the expected text |
| TLS | beacon/rules/<key>.tls | The connection or the handshake fails, the certificate does not verify for the host, or fewer days are left than the minimum (14 by default) |
A check can also be a Custom rule made in Desk. The region header names one region, or all for every active region. Each region then has its own alert. A file with no region header makes a check that is off. Desk then sets its Regions and turns it on. The URL and the host can use variables, so one file works in every region:
| Variable | Value | Kept in |
|---|---|---|
{region} | The region name | Beacon Region |
{wildcard_domain} | The site domain of the region | Beacon Region |
{atlas_url} | The scheme and host of the region's Atlas | The Base URL of the atlas Resource Source |
{central_url} | The Central address | Beacon Settings |
Beacon refuses an unknown variable when the rule is saved. When a variable has no value in a region, Beacon logs an error and skips the check there, so its alert keeps its state.
Configured checks
| Check | Kind | Target | Regions | Severity |
|---|---|---|---|---|
atlas-api-unreachable | HTTP | {atlas_url}/api/atlas/jwks.json, which needs no sign-in. Fails for 3 minutes. | All | High |
atlas-certificate | TLS | {atlas_url}, at least 14 days left | All | Medium |
central-dashboard-unreachable | HTTP | {central_url}/dashboard. Fails for 3 minutes. | Set in Desk | High |
central-api-unreachable | HTTP | {central_url}/api/method/ping. Fails for 3 minutes. | Set in Desk | High |
central-certificate | TLS | {central_url}, at least 14 days left | Set in Desk | Medium |
object-storage-unreachable | HTTP | https://s3-admin-svc.{wildcard_domain}/health, through the gateway to Garage. Fails for 3 minutes. | All | High |
telemetry-unreachable | HTTP | https://telemetry-svc.{wildcard_domain}/health. Fails for 3 minutes. | All | High |
object-storage-certificate | TLS | s3-svc.{wildcard_domain}, at least 14 days left | All | Medium |
telemetry-certificate | TLS | telemetry-svc.{wildcard_domain}, at least 14 days left | All | Medium |
telemetry-read-certificate | TLS | telemetry-read-svc.{wildcard_domain}, at least 14 days left. Beacon reads ClickHouse on this name. | All | Medium |
S3 itself has no health route and refuses a request that is not signed, so Beacon checks only the certificate of s3-svc, and the health route of s3-admin-svc on the same gateway. The proxies have their own health check, so Beacon does not call a test site behind them. The Central checks name no region, because the Central Telemetry Region depends on the site.
Customer or infrastructure
Two systems send alerts. Pilot tells the customer about one server or one site. Beacon tells the Frappe Cloud team when many customers share a problem, or when the platform fails. So Beacon does not add a rule for one site or one customer server.
What Pilot sends to the customer
Pilot sends each event to the webhooks of the customer. It also sends an alert by email, to the recipients set on the server, and to Central, which shows it to the customer. Central accepts only the event types that it defines.
| Event | When | Goes to | What Beacon sees |
|---|---|---|---|
site_down | A site does not answer the uptime ping. The customer can turn it off (site_uptime). | Webhooks, email, Central (site_unavailable) | pilot_sites counts. pilot-sites-down fires when 3 or more sites, and 20% or more, are down on one server. The Sites SLI counts all sites. |
resource_limit_breached | CPU, memory or disk use stays above the limit of the customer, 90% by default. | Webhooks, email, Central | Nothing for a customer server. The machine rules cover platform machines only. |
backups_failing | The backups of one site keep failing. | Webhooks, email, Central (backup_failure) | pilot-backups-failing fires when 5 or more servers, and 10% or more, fail. |
task_failed of an update | An update fails. | Webhooks, email, Central (migration_failure) | pilot-updates-failing fires when one release of one repository fails on 3 or more servers. |
certificate_expiry, certificate_failed | A site certificate has less than 14 days left, or does not issue or renew. | Webhooks, email, Central | Nothing for a customer site. Atlas watches the wildcard and metald certificates. A TLS rule can check any host from outside. |
Other events, such as site_up and other failed tasks | A site answers again, a task fails | Webhooks and the feed | Nothing |
When Pilot cannot reach Central, the customer hears nothing. pilot-central-delivery fires on 3 failed deliveries in 15 minutes. pilot-silent fires when Pilot stops sending.
What counts as an infrastructure failure
| Service | Bad (counts against the SLO) | Not counted |
|---|---|---|
| Sites | A site that does not answer the ping on a running server | A site in maintenance. Known limit: app request hooks run on the ping, so an app fault can count as bad. |
| Servers | A server that should run and is not available | A stopped or sleeping server, a draft |
| Networking | A 5xx that the proxy made itself | A 5xx from the site's own code |
| Object Storage | An S3 answer with 5xx | 403 and 404, which are normal S3 answers |
| Dashboard and API | A Central request that fails with 5xx | A 4xx, which is an error of the client |
| Server actions | A create, start, stop, restart or resize action that fails or times out. A region at capacity is bad, because capacity is our problem. | Terminate, which no customer waits for |
Atlas and metald
Atlas runs the hosts, the VMs and the service nodes of a region. metald runs on each host. The Datum agent runs on each service VM and on the Cargo VM.
Data sent to Datum
| Data | Type | Sender (resource ID) | What it tells |
|---|---|---|---|
15 system_* machine metrics: boot time, CPU count and seconds, load, memory, swap, file systems, disk and network bytes and errors | Gauges and counters | Each host (metald), each service VM and the Cargo VM (Datum agent) | The health of the machine. system_boot_time_seconds is the heartbeat. |
More host system_* detail, each 60 s: CPU frequency and throttles for each package, interrupts and schedstat totals, softnet, the netstat, vmstat and memory info allowlists, hwmon inputs and alarms, cooling devices, EDAC, SMART value and raw | Gauges and counters | Each host (metald) | Hardware faults, and detail to investigate an alert |
metal_* | Gauges and counters | Each host (metald) | VM states, ZFS, md, SMART, hardware, metald loops |
bmc_health, bmc_component_health, bmc_temperature_celsius, bmc_fan_speed, bmc_power_watts, bmc_power_supply_*, bmc_clock_offset_seconds, bmc_system_info | Gauges, each 5 min | atlas | The BMC readings of each host |
atlas_machine{machine, kind} | Gauge, each min | atlas | The machines that must send now: Running hosts and VMs that run and do not sleep |
atlas_metal_servers{status}, atlas_metal_server_info, atlas_host_sync_age_seconds, atlas_host_cpu_millicores, atlas_host_memory_bytes, atlas_host_storage_bytes, atlas_host_virtual_machines | Gauges, each min | atlas | Host inventory, sync age and allocation |
atlas_virtual_machines{server, state}, atlas_virtual_machine_drafts, atlas_virtual_machine_oldest_draft_seconds, atlas_virtual_machines_terminating | Gauges, each min | atlas | VM states and stuck drafts |
atlas_migrations_active, atlas_migration_oldest_active_seconds, atlas_migrations_total, atlas_migration_duration_seconds | Gauges and counters | atlas | VM migrations |
atlas_virtual_machine_images, atlas_virtual_machine_image_stored_bytes | Gauges, each min | atlas | VM images |
atlas_public_ip_capacity, atlas_public_ip_allocations | Gauges, each min | atlas | Free public IP addresses in each pool |
atlas_ssh_tasks_active, atlas_metald_updates_active | Gauges, each min | atlas | Work in progress |
atlas_service_servers{service, status}, atlas_service_node, atlas_service_ready | Gauges, each min | atlas | Service nodes (proxy, WireGuard gateway, IPv6 router, Cargo) and their readiness probes |
atlas_job_queue_length, atlas_job_failed, atlas_job_started {queue} | Gauges, each min | atlas | Background job queues |
atlas_api_requests_total, atlas_api_request_duration_seconds, atlas_metal_requests_total, atlas_metal_request_duration_seconds | Counters | atlas | Atlas API calls and calls to metald |
atlas_filesystem_bytes{path, kind} | Gauge, each min | atlas | Free space on the Atlas machine |
atlas_error_logs_last_minute | Gauge, each min | atlas | New Error Logs |
atlas_tls_certificate_expiry_seconds{certificate, server} | Gauge, each min | atlas | Time left on the wildcard and metald certificates |
atlas_warpgate_sync_age_seconds | Gauge, each min | atlas | Time since the last Warpgate sync that reached every host |
proxy_requests_total{origin, ...}, proxy_request_seconds_total, proxy_upstream_seconds_total, proxy_slow_requests_total | Counters | Each proxy VM | Requests, from the nginx access log on the VM. origin tells a proxy 5xx from a site 5xx. |
wireguard_peers, wireguard_peers_active | Gauges | Each WireGuard gateway VM | Configured and active peers |
ipv6_router_program_attached | Gauge, each 30 s | Each IPv6 router VM | The eBPF program is on eth0 |
Log lines, source = journal, at warning and higher; metald also at info | Logs | Each host (product metal), each service VM (product atlas), the Cargo VM (product cargo) | System and service errors |
Log lines, source = file | Logs | Each proxy VM | The nginx error log at error and higher, without upstream errors |
Log lines, source = error_log | Logs | atlas | Atlas Error Logs |
Log lines, source = bmc | Logs | atlas | The BMC event log of each host |
Alert rules (32)
| Rule | Title | Severity | Resource | Fires when |
|---|---|---|---|---|
atlas-silent | Atlas silent | Critical | Region | No Atlas gauges for 3 min |
host-down | Host down | Critical | Metal Host | A Running host has no recent sync, and metald is silent |
atlas-api-errors | Atlas API errors | High | Atlas | 5 errors and 5% of the calls of one operation in 10 min, or over 1% of all calls in 15 min |
atlas-cannot-sync-host | Atlas cannot sync host | High | Metal Host | A Running host has no recent sync, but metald still sends |
atlas-disk-full | Atlas disk almost full | High | Atlas | Under 10% free (High), under 25% free (Low) |
atlas-metal-errors | Atlas cannot reach metald | High | Atlas | A burst of failed metald calls; repeated failures for 1 h, or any 401 or 403, are Medium |
atlas-public-ips-exhausted | Public IPv4 pool almost empty | High | Atlas | No free public IPv4 address (High); fewer than 5, or under 10% free (Medium) |
atlas-queue-backlog | Atlas queue backlog | High | Atlas | 100 or more jobs wait in one queue for 10 min |
atlas-service-nodes-failed | Service nodes failed | High | Atlas | A service node is Failed |
bmc-problems | BMC problems | High | Metal Host | A critical BMC event (High); an unhealthy component or an unreachable BMC (Medium); a warning event (Low) |
host-hardware-degraded | Host hardware degraded | High | Metal Host | An uncorrected memory error (High); a failing disk or a hot CPU (Medium); wear signs (Low) |
host-pool-capacity | Host pool almost full | High | Metal Host | A ZFS pool over 90% (High) or 80% (Low) used |
host-storage-failed | Host storage failed | High | Metal Host | A pool, array or mount can lose data or stop writes |
ipv6-router-detached | IPv6 router not forwarding | High | IPv6 Router Server | The eBPF program is not on eth0 |
machine-disk-full | Machine disk almost full | High | Metal Host, Virtual Machine | A file system under 10% (High) or 25% (Low) free. ZFS and tenant VMs are left out. |
metald-unhealthy | metald unhealthy | High | Metal Host | A metald loop stalls, a change waits, or VMs fail |
service-node-not-ready | Service node not ready | High | Proxy Server, Wireguard Gateway Server, IPv6 Router Server | A service node fails its readiness probe twice in 3 min |
tls-certificate-expiring | TLS certificate expiring | High | Atlas | Under 3 days (High) or 21 days (Medium) left |
vms-unavailable-on-host | VMs unavailable on host | High | Metal Host | 3 VMs and 20% of the wanted VMs are down (High); fewer is Medium |
atlas-error-logs | Atlas unhandled errors | Medium | Atlas | A new error repeats 3 times in 1 h, or any error repeats 5 times in 15 min |
atlas-failed-jobs | Atlas jobs failing | Medium | Atlas | 3 failed jobs in 1 h |
atlas-stuck-work | Atlas work stuck | Medium | Atlas | A migration runs, or a draft VM waits, for 1 h |
host-limits | Host near a kernel limit | Medium | Metal Host | Conntrack or the open file table is near full, or the clock is not synced |
host-network-errors | Host network errors | Medium | Metal Host | A link is down (Medium); over 10 NIC errors in 1 h (Low) |
host-stress | Host under stress | Medium | Metal Host | High CPU, memory or I/O pressure for 15 min |
host-systemd-units | Host systemd units failing | Medium | Metal Host | A failed unit (Medium); 3 restarts in 1 h (Low) |
machine-silent | Machine silent | Medium | Metal Host, Virtual Machine | A host or service VM in atlas_machine sends no machine metrics for 3 min. Tenant VMs are left out. |
machine-stress | Machine under stress | Medium | Metal Host, Virtual Machine | Over 90% memory used, or load over 1.5 per core, for 15 min |
proxy-error-spike | Proxy errors | Medium | Proxy Server | Proxy-made 5xx at 5 times the share of the last 70 min, or over 5% |
vm-migrations-failed | VM migrations failed | Medium | Metal Host | A VM migration failed in the last hour |
warpgate-sync-failing | Warpgate sync failing | Medium | Atlas | No full Warpgate sync for 15 min |
repeated-errors | Repeated errors | Low | Metal Host, Virtual Machine | One log message 10 times in 1 h |
Cargo and Datum
Cargo builds Pilot images and runs object storage (Garage) and the Datum host of a region. The rules that watch Datum are in Cargo, because Cargo runs the Datum host.
Data sent to Datum
| Data | Type | Sender (resource ID) | What it tells |
|---|---|---|---|
15 system_* machine metrics | Gauges and counters, each min | Each Cargo machine and the Cargo VM (Datum agent) | The health of the machine |
garage_*, such as garage_cluster_available, garage_cluster_storage_nodes_ok, garage_local_disk_avail, garage_api_s3_request_counter, garage_api_s3_error_counter, garage_block_resync_errored_blocks | Gauges and counters, from the Garage admin API | Each gateway and storage node | Cluster health, disks, S3 requests and errors, resync |
cargo_machine{machine, role, cluster} | Gauge, each min | cargo | The running Cargo machines, and the VM that runs Cargo (role cargo) |
cargo_object_storage_health{cluster, health} | Gauge, each min | cargo | The health verdict of each live cluster |
cargo_object_storage_metadata_backup_age_seconds{cluster} | Gauge, each hour | cargo | The age of the newest uploaded metadata backup |
cargo_pilot_image_latest, cargo_pilot_image_in_progress_seconds, cargo_pilot_image_newest_completed_age_seconds, cargo_pilot_image_failed_attempts | Gauges, each hour | cargo | Pilot image builds |
| Pilot data of the Cargo VM: heartbeat, sites, backups, database state, disk space, calls to Central, update events | See pilot#828 | The Cargo VM | The Cargo site |
Log lines, source = journal, warning and higher, Garage with a module attribute. Only the Garage series that a rule or chart reads. | Logs | Each Cargo machine | System and Garage errors. Signed URLs are removed. |
Log lines, source = file | Logs | The gateway, the Datum host | The nginx error log at error and higher, and the ClickHouse error log |
Log lines, source = error_log | Logs, each min | cargo | Cargo Error Logs |
Alert rules (15)
| Rule | Title | Severity | Resource | Fires when |
|---|---|---|---|---|
object-storage-unavailable | Object storage unavailable | Critical | Cargo Server | Garage is unavailable or silent on every node |
datum-ingest-stopped | Datum stores no new samples | High | Region | Datum stores no new sample for 3 min |
object-storage-disk-full | Object storage disk almost full | High | Cargo Server | A Garage disk has under 10% free |
object-storage-errors | Object storage errors | High | Cargo Server | 10 S3 requests fail with 5xx in 10 min, and over 1% of the requests |
object-storage-health | Object storage health | High | Cargo Server | A cluster is Critical (High); Degraded, Unknown or silent for 10 min (Medium) |
cargo-build-failed | Cargo image build failed | Medium | Cargo Server | The newest build of an image failed |
cargo-build-stuck | Cargo image build stuck | Medium | Cargo Server | A build runs for 2 h |
cargo-errors | Cargo errors | Medium | Cargo Server | One unhandled error repeats 5 times in 15 min |
cargo-images-stale | Cargo images stale | Medium | Cargo Server | The newest usable image is older than 2 days |
cargo-silent | Cargo silent | Medium | Cargo Server | No image build metrics for 3 h |
datum-writes-refused | Datum refuses writes | Medium | Region | Datum refuses 10 requests of one sender in 15 min. A 5xx is High. |
object-storage-backup-stale | Object storage backup stale | Medium | Cargo Server | No metadata backup in the last day |
object-storage-redundancy | Object storage redundancy lost | Medium | Cargo Server | A storage node is not OK, or blocks failed to resync |
telemetry-dropped | Telemetry dropped on machine | Low | Metal Host, Virtual Machine | The Datum agent counts the events that it drops: lines over the log cap, events that a full buffer drops, and events lost by error. A role file that drops a line on purpose does not count. Each drop is a gap in the data of the machine, so 100 in 1 h alerts. |
telemetry-volume | Telemetry volume grew | Low | Region | Datum counts the samples and log lines of each sender each day. A sender that sent more than 2 times its median of the 7 days before, and more than 100,000 rows, often runs a new version that sends a new metric or logs too much. The rule finds it before the storage cost does. |
Central
Central is global. It sends its telemetry as central to the Datum of one region, and its rules and SLIs report on that region.
Data sent to Datum
| Data | Type | What it tells |
|---|---|---|
central_requests{group, status_class} | Gauge, each min | API requests since the last push, by central.api module and status class |
central_resource_action_oldest_open_seconds{region, resource_type, action}, central_resource_actions_finished_last_hour{..., status} | Gauges, each min | Resource actions that are open, and the ones that finished |
central_payment_attempts_last_hour{gateway, status}, central_payment_last_capture_seconds{gateway} | Gauges, each min | Payment attempts and the newest capture |
central_gateway_webhooks_unprocessed, central_gateway_webhook_oldest_unprocessed_seconds, central_gateway_webhooks_failed_last_hour {gateway} | Gauges, each min | Payment gateway webhooks that wait or failed |
central_billing_run_oldest_open_seconds, central_invoices_sync_failed | Gauges, each min | Billing runs, and invoices that did not sync to accounting |
central_site_domains_failed_last_hour, central_site_domain_oldest_pending_seconds {route_type} | Gauges, each min | Proxy routes |
central_vm_snapshots_failed_last_day{snapshot_type}, central_vm_snapshot_oldest_pending_seconds | Gauges, each min | VM snapshots |
central_emails_failed_last_hour, central_email_oldest_unsent_seconds | Gauges, each min | The email queue |
central_job_queue_length{queue}, central_scheduled_job_late_seconds{job} | Gauges, each min | Background queues and late scheduled jobs |
frappe_webhook_requests_last_day{webhook, status} | Gauge, each min | Outgoing webhook requests. Exhausted means Frappe gave up. |
Log lines, source = error_log, level error | Logs, each min | Central Error Logs, up to 1,000 lines for each push |
Alert rules (7)
| Rule | Title | Severity | Resource | Fires when |
|---|---|---|---|---|
central-api-errors | Central API errors | High | Region | Over 5% 5xx in 10 min, with 50 requests or more (High); over 1% in 1 h, or one group with 10 errors and over 10% (Medium) |
central-payments | Central payments failing | High | Region | 5 failed payments that are half of the attempts of a gateway in 1 h, or a gateway webhook that waits 15 min (High); a failed webhook (Medium); no capture for 1 day (Low) |
central-resource-actions | Central resource actions failing | High | Region | 3 failed or timed out actions that are 20% of the finished ones in 1 h, or an action open for 2 h (High); open for 30 min (Medium) |
central-silent | Central silent | High | Region | No Central gauges for 5 min, after Central sent them in the last 14 days |
central-webhooks-failing | Central webhooks failing | High | Region | 10 exhausted requests that are 20% of one webhook in 1 day (High); one exhausted request, or 10 that still retry (Medium) |
central-background-work | Central background work stuck | Medium | Region | A billing run open for 1 day, a proxy route pending 30 min or 3 failed in 1 h, a failed or stuck snapshot, failed or late emails, a scheduled job 15 min late, or 1,000 queued jobs (Medium); invoices that do not sync (Low) |
central-errors | Central errors | Medium | Region | One unhandled error repeats 5 times in 15 min |
Pilot
Pilot runs the sites on each customer server. It tells the customer about the problems of one server, and sends Datum only the numbers that show a problem across many servers.
Data sent to Datum
| Data | Type | What it tells |
|---|---|---|
pilot_info{version} | Information, each 5 min | The heartbeat of Pilot |
pilot_sites{state} | Gauge, each min | Sites up, down and in maintenance, from the uptime pings. Zeroes are sent. |
pilot_site_backups{status} | Gauge, each 5 min | Sites whose newest backup of the last day succeeded or failed |
pilot_database_up | Gauge, each 5 min | 1 when the database accepts connections |
system_filesystem_size_bytes, system_filesystem_available_bytes {mountpoint, device, type} | Gauge, each 5 min | Disk space |
pilot_central_requests_last_5_minutes{method, result} | Gauge, each 5 min | Calls to Central, ok or failed |
Update events: product pilot, service update, source event | Log line, each app of each update | app, repository (such as frappe/erpnext), from_version, to_version, status, phase, site. A failure has level error and the end of the output. |
Alert rules (5)
| Rule | Title | Severity | Resource | Fires when |
|---|---|---|---|---|
pilot-backups-failing | Site backups failing on many servers | High | Region | The newest backup failed for most sites on 5 servers that are 10% of the servers. Half of the servers is High. |
pilot-central-delivery | Pilot cannot send alerts to Central | High | Virtual Machine | 3 report_pilot_event calls fail in 15 min |
pilot-sites-down | Sites down on server | High | Virtual Machine | 3 sites, and 20% of the checked sites, are down. The detail names the database state. |
pilot-silent | Pilot silent | Medium | Virtual Machine | No pilot_info or no pilot_sites for 10 min, on a VM that Atlas expects to run |
pilot-updates-failing | App update failing on many servers | Low | Region | One release of one repository fails on 3 or more servers in 6 h |
Datum agent (all machines)
The Datum agent is Vector with one configuration from frappe/datum. Atlas and Cargo install it. Role files add the data of one role.
Data sent to Datum
| Data | Type | What it tells |
|---|---|---|
system_boot_time_seconds, system_cpu_count | Gauges, each min | The heartbeat and size of the machine |
system_cpu_seconds_total{cpu, mode} | Counter | CPU time by /proc/stat mode |
system_load_average{window} | Gauge | Load for 5 and 15 min |
system_memory_total_bytes, system_memory_available_bytes, system_memory_swap_used_bytes | Gauges | Memory and swap |
system_filesystem_size_bytes, system_filesystem_available_bytes {mountpoint, device, type} | Gauges | File system space |
system_disk_read_bytes_total, system_disk_written_bytes_total {device} | Counters | Disk I/O |
system_network_receive_bytes_total, system_network_transmit_bytes_total, system_network_receive_errors_total, system_network_transmit_errors_total {interface} | Counters | Network traffic and errors |
Role metrics, metrics_* in a role file | As the role defines | For example proxy requests or Garage |
Log lines, source = journal, at warning and higher; INFO_UNITS also at info | Logs | System and service errors. A JSON line gives its fields as attributes, at most 64. |
Log lines from a role, logs_* in a role file | Logs | For example the nginx error log |
datum_agent_dropped_events_total{component, reason} | Counter, each min, also on hosts | Events that the agent dropped: cap, buffer_full or error |
One JSON log line for each refused /v1/ request, with sender and status | Logs, from Datum itself | Writes that Datum refused |
Review status
I checked each resource ID from the sender to the resource list, and each customer-facing part for a service and a paging rule. These changes came from the review.
Pilot sent under the wrong resource ID central#714
Central gave the Pilot token the Central name of the server, not the Atlas VM name that Atlas lists. Beacon dropped every Pilot rule row, pilot-silent could never fire, and the Sites SLI had no reporters. Central now uses atlas_vm_id, and refuses a server that Atlas has not bound yet.
SLOs for the dashboard, the API and server actions central#714
Two global services: Dashboard and API at 99.9%, and Server actions at 99%. Both report on the region, because Central is in no resource list. The Central Telemetry Region depends on the site, so Desk sets their Query Region.
HTTP and TLS checks with variables beacon
Beacon has a TLS rule kind beside HTTP. Both can use {region}, {wildcard_domain}, {atlas_url} and {central_url}, and region: all. A file can leave out the region, and Desk sets it. See Endpoint checks.
Certificate alerts reach Central central#714 pilot#828
Central defines certificate_expiry (Warning) and certificate_failed (Error), and Pilot sends them there. A customer without webhooks or email recipients now learns that a certificate does not renew.
One resource ID, clear type names beacon atlas#607
The unused Telemetry IDs source is removed, so Beacon finds a resource by its resource ID only. Atlas lists hosts as Metal Host and VMs as Virtual Machine, and every rule names the registry types of its rows.
Checks from outside beacon atlas#607 central#714
Beacon now calls the Atlas API of each region, the Central dashboard and API, and reads their certificates. See Endpoint checks.
A rule reads only its own sender atlas#607 cargo#141 central#714 datum#20
A machine could send a metric with the name and labels of a product metric, and fire or silence a product rule. Each product rule now reads only the rows that the product sends as itself (resource_id = 'atlas', 'cargo' or 'central'), or the machines that its inventory lists. Datum refuses those three IDs in the token of another issuer.
Rows of other types and disabled resources stay out beacon cargo#141 pilot#828
Beacon drops a rule row whose resource type is not in the resource_type of the rule. A fleet-wide rule leaves out the resources with monitoring disabled through {excluded:Array(String)}, so a server that a person turned off does not count toward a threshold.
Cargo signs the Datum tokens of its services cargo#141 central#714 datum#20
Atlas runs the VMs, and Cargo runs the regional services, so Cargo signs for them with its own Ed25519 key. Central no longer gives Cargo tokens. Roll out Cargo first, run setup again on each Datum Server and object storage cluster, then deploy Central. See Who signs the token.
Checks of object storage and telemetry from outside cargo#141
Beacon now calls the object storage gateway and the telemetry endpoint of each region, and reads the certificates of s3-svc, telemetry-svc and telemetry-read-svc. The rules inside the region do not see a wrong DNS record, a stopped Caddy or an expired certificate. See Endpoint checks.
Passwords stay out of the process list datum#20 cargo#141
datum-migrate reads every user password from the environment, and Cargo passes them with su -w. Before, the insights and default passwords were flags that ps showed.
Journal fields stay valid attributes datum#20
The Datum agent makes the field names of a JSON journal line valid attribute names and sends at most 64, so one line cannot make Datum refuse its batch.
Open: Grove is not covered
Grove boxes send as grove:<machine>, and no resource source lists them. Beacon drops their rows. Decide: add a Grove resource source and rules, or leave Grove out of Beacon.
Developer guide: add a service
Do these steps to connect a new service to Datum and Beacon. The full guide is docs/integration.md in frappe/beacon.
1. Decide what to watch
- The symptom: what a customer sees when the service fails, as good events of valid events, such as requests without a 5xx. It becomes the SLI. A fast burn of its error budget pages.
- The cause: a part that breaks and has one fix, such as a full disk or a stuck queue. It becomes a cause rule.
- Send counts, not items. A site, a VM, a request, a job or a user is never a label value. Each label value adds one series.
2. Get a token from the issuer that already trusts you
Do not make a new key set. A machine sends as its Atlas Virtual Machine or Metal Server name, and an application as its own name. See Who signs the token. The token is for one region and has an expiry, so renew it before it expires. Beacon keeps only the rows whose resource ID it knows, so the ID must be in a resource list (step 6).
3. Send metrics and logs
Name a metric namespace_subsystem_target_unit, with _total at the end of a counter. Use base units: seconds and bytes. Send a gauge for a value that goes up and down, and the running total for a counter. Give all series of one collection the same timestamp, so a rule can read the newest collection only.
from datum_client import Batch, Datum
batch = Batch("cargo", "object_storage")
batch.gauge("backup_age", age_seconds, unit="seconds", cluster="garage-1")
batch.counter("backups", completed, cluster="garage-1") # cargo_object_storage_backups_total
with Datum(url, token) as datum:
datum.send(batch)
A machine with the Datum agent sends its journal already. Add a role file for an exporter (metrics_<name>) or a log file (logs_<name>). A Frappe app sends its Error Logs from a scheduled job with source = 'error_log'. Limits: 12 requests a minute for each resource and endpoint, 10,000 samples a request, 64 labels a sample.
4. Write a rule and a runbook
Put one file in beacon/rules/<rule-key>.sql of your repository. The header sets the timing, and the query returns only failing rows: resource_id, alert_key, value, detail, and an optional severity.
-- title: Object storage backup stale
-- severity: Medium
-- resource_type: Cargo Server
-- interval: 900
-- pending_for: 900
-- resolve_after: 3600
-- runbook_url: https://github.com/frappe/cargo/blob/develop/beacon/runbooks/object-storage-backup-stale.md
SELECT 'cargo' AS resource_id, cluster AS alert_key, age AS value,
concat('the newest metadata backup of ', cluster, ' is ', toString(round(age / 3600)), ' h old') AS detail
FROM (
SELECT labels['cluster'] AS cluster, argMax(value, ts) AS age
FROM datum.samples_recent
WHERE metric = 'cargo_object_storage_metadata_backup_age_seconds'
AND resource_id = 'cargo' AND ts > now() - INTERVAL 3 HOUR
GROUP BY cluster
)
WHERE age > 86400
- Filter on the sender. Only
resource_idcomes from the token. Any token of the region can send any metric name and labels, so readresource_id = 'cargo', not the name alone. - Filter in a subquery.
SELECT 'cargo' AS resource_id ... WHERE resource_id = ...compares the constant, not the column. - Name the types.
resource_typelists the registry types of the rows. Beacon drops a row of any other type. - Leave out disabled resources. A query that adds many resources into one row filters
resource_id NOT IN {excluded:Array(String)}. Beacon drops the rows of such a resource itself. - Use rates. Compare failures with the total, such as 5 failed of 20 attempts or more.
- Choose the times.
intervalis how often the data changes.pending_foris how long a problem must stay before a person must know.resolve_afteris at least 2 intervals. - Page only for customer impact. Each High or Critical rule has a runbook in
beacon/runbooks/<rule-key>.md: what failed, what eachalert_keymeans, the steps to fix, and when to escalate.
Test the query before you merge it, with rows that fail and rows that do not:
clickhouse-client --param_region=blr1 --param_excluded="[]" < beacon/rules/object-storage-backup-stale.sql
5. Define an SLI
When customers use the service, add beacon/services/<service>.sql. It returns one row for each reporter: resource_id, good, valid and last_ts, and sets slo_target in its header. Count only the failures that the platform causes. A global service reports as the region, {region:String} AS resource_id, and sets its Query Region.
6. Serve a resource list
A regional service that runs infrastructure serves GET <base>/beacon/resources with an ETag. Beacon signs in with a Frappe API key and reads it each minute.
{"resources": [{"resource_id": "h12", "resource_type": "Metal Host", "parent_id": "", "title": "h12", "status": "Active"}]}
A Suspended resource gives no alerts. A resource that is missing from 2 good fetches becomes Terminated. When one fetch removes more than 10% of the resources, Beacon holds the removal until an admin applies it.
7. Sync
Add the repository as a Definition Source in Beacon Settings, with its branch and the folder beacon, and select Sync Definitions. A sync applies all files of a source or none: one bad header or one failing query stops it. Desk can only turn a file rule on or off and set its regions. Change everything else in the file.
How Beacon runs the rule
Each minute, Beacon queues one job for each region with due rules. For each due rule:
- Run the query as the
beaconuser, with{region}and{excluded}. A query error changes nothing. 3 errors in a row mark the rule Broken. - Drop the rows of unknown resources, of other types, of resources that are not checked, and of resources that are new in the last 10 minutes.
- Compare the rows with the open alerts and write only the changes.
| From | When | To |
|---|---|---|
| None | A new failing row | Pending |
| Pending | The row fails for pending_for | Firing. The alert joins an open incident, which pages. |
| Pending | A good run without the row | Resolved (Cleared) |
| Firing | No row for resolve_after | Resolved (Recovered). A job closes the incident when all its alerts recover. |
| Pending, Firing | The resource is removed, or monitoring is disabled | Resolved |
A silence, a maintenance or a held removal suppresses an alert: it keeps its state, but it does not join an incident and does not page. Beacon never publishes an incident. A person decides what the status page shows.
Before you merge
- Each metric name follows the pattern, and each counter ends in
_total. - No label has a value for each site, VM, request, job or user.
- The data shows in
samples_recentfrom a real sender, with the resource ID that the registry has. - Each rule reads only its own sender and points to one fix. You ran it on data that fails and data that does not.
- Each High or Critical rule has a runbook.
- No log line or label holds a secret.