Watch
Excubio Watch is the external dead-man's switch. It pages when the
customer's alerting can't: the customer has no internet, a firewall or
routing problem cuts the hub off, both data centres fail, or the Excubio
cloud fails. Tables: schema/watch.sql; endpoints:
api/watch.yaml.
1. Checks
| Type | Direction | Fails when |
|---|---|---|
hub | Hub → Watch, every 30 s from every node a batch with a heartbeat of each hub it serves, each signed with its hub's Watch key | No heartbeat from any node for interval + grace, or the newest heartbeat of any node reports a bad state: pipeline lag, task backlog or cloud link down beyond the check's thresholds. The nodes report the hub's shared state, so the newest report stands for all. |
push | Customer sender → Watch, POST or GET /hb/<token> | No beat for interval + grace, or a POST /hb/<token>/fail. Senders are scheduled tasks, an SMS gateway monitor, an external monitoring satellite. |
reverse | Customer probe → Watch, GET /rc/<token> | Watch never fails it. The customer's probe verifies the signed answer (Ed25519 with Watch's published answer key, operations.md §6) and raises a local event when it fails ("external watchdog unreachable"). Watch records the calls, so a missing probe can also be a push-style failure if expect is set. |
synthetic | Watch → hub → cloud → carrier | No delivery receipt for the test page within 5 min. Runs at the hub's cadence (below). |
- A beat's body is ignored, whatever its content type, up to 64 KiB, so
senders that post event JSON to their current watchdog can point at Watch
unchanged.
/failtakes an optional plain-text reason (up to 1 KiB) that goes into the message: a sender that is alive but sees its own check fail says so instead of going silent. - The token can also be sent as a bearer header instead of in the path.
POST /api/v1/checks/{id}/tokenissues a new token; the old one keeps working for 24 hours.
Hubs. When a hub enrols, the cloud passes its Watch key to Watch
and creates the hub's hub and synthetic checks with the hub's Watch
rotation and fallback numbers
(operations.md §4); renewing the key replaces
it. The cloud is the home of that rotation and those numbers: it passes
every change on (§5), and Watch doesn't change
them. These two checks come with the hub and don't count against the
tenant's watch_checks, which limits push and reverse checks and is
enforced by Watch. A hub check starts
with interval 30 s, grace 90 s and the thresholds pipeline lag 5 min,
10,000 pending tasks and cloud link down 5 min; a tenant admin can change
them at Watch. Revoking the hub drops the key and pauses both checks
(reason hub revoked, no end) until the hub enrols again, which resumes
them; decommissioning it deletes them. With the hub the cloud passes the
vendor's installation that runs it, if any, which Watch needs for an
installation failure (§5).
Heartbeats. Every node of an installation sends one batch every 30 s
(api/watch.yaml hubHeartbeats), with a heartbeat of
each hub it serves, at most 500; a node with more hubs sends several
batches, and the node of a standalone installation a batch of one.
Each heartbeat is signed with its own hub's Watch key, which all nodes
serving the hub share, and Watch verifies each with that key and takes or
refuses it alone: Watch trusts no key of the installation for a hub's
liveness, so a heartbeat signed with another hub's key is refused, and an
installation that no longer holds a hub's key can't vouch for it. Watch
refuses a heartbeat whose at is more than 60 s from its own time, so a
recorded batch can't be replayed later. It answers each heartbeat with its
result, and records the accepted ones of a batch in one call across their
tenants (schema/watch.sql hub_beats).
Cadence of the synthetic tests. The cloud passes it with the hub, from
the tenant's plan (synthetic_every, an hour to a week,
architecture.md §12 Plans).
Without one, a hub is tested hourly, or daily on a shared installation.
The vendor's own hub on a shared installation, its operator hub, which a
vendor operator names in the cloud's registry of installations, is
passed with an hour whatever its plan, so each shared installation is
tested hourly through it. A hub's
first test is due with its first heartbeat; after a receipt the next
one falls at the hub's offset within its cadence, its id modulo the
cadence, so the tests of many hubs spread over the hour or the day.
The synthetic check rides on the hub heartbeat, so Watch never connects
into the customer network:
- When a test is due, Watch answers the hub's next heartbeat with a test request in its result: a test ID and an 8-character test code. Only that one node gets it.
- The hub injects it as an alert of kind
selfwith the test code, which a built-in rule pages to the rotationsyntheticof the reserved teamexcubio(pipeline.md §10). - The cloud creates that team and rotation with every tenant. The rotation has no layers and no people, doesn't count against the licence and isn't shown in the UIs; its incidents are delivered by one SMS to its handset, Watch's test number (operations.md §3), through the cloud's SMS carriers like any SMS, without a person, chain or escalation (on-call.md §6), and the incident title carries the test code. Without a test number, or under the cloud's evaluation delivery, the cloud hands the SMS of a tenant under evaluation to Watch instead (on-call.md §4).
- Watch matches the SMS arriving at its test number by the test code. No
match within 5 min fails the check with cause
no-receipt.
2. Check definition and notification
| Field | Meaning |
|---|---|
interval, grace | Expected beat interval and tolerance. |
severity | Shown in the message. |
rotation | A cloud rotation (team/rotation) to page, resolved from the replica by the rotation's ID, so a renamed team or rotation keeps its checks. |
alsoNotify | Further rotations. |
fallbackNumbers | Required, at least one. Used when the replica has no valid person for a rotation, and paged from the second round of an unacknowledged failure. |
recovery | notify (default) or none. |
webhook | Optional URL and signing key; Watch posts watch.check.failed, watch.check.acknowledged, watch.check.recovered, watch.check.paused and watch.check.resumed, signed as hub webhooks (integrations.md §8), at least once from an outbox, with retries for 24 hours (schema/watch.sql webhook_delivery). Only https URLs whose addresses are public: Watch applies the egress rules of architecture.md §11 with a deny list of private, loopback, link-local, multicast and reserved ranges and of the IPv6 ranges that carry an IPv4 address (mapped, NAT64, 6to4, Teredo), without a proxy and without following redirects. |
-
Missing → Watch pages the person on call of
rotationand of everyalsoNotifyrotation at once, through its own carrier: by SMS, which every plan includes, and by voice where the tenant's plan allows calls, which the cloud passes with the tenant (voice, by default allowed; never for a tenant in trial, on-call.md §4). Without an acknowledgement it pages again every 5 min for three rounds, then every 30 min until the check recovers; the fallback numbers are paged too from the second round. A round waits while the previous one still has messages queued. The first acknowledgement from any of them stops the rounds for everyone; who acknowledged is recorded and sent to the others. A failure that is acknowledged and hasn't recovered after 4 hours pages again, from the first round, so one reply never silences a check for good. -
Throttle. Watch hands its carrier at most 10 messages a second, across tenants, oldest check event first; what a pass couldn't send waits for the next. The vendor's pages (§5) go outside it.
-
Evaluation. Watch sends nothing to the numbers of a tenant that the cloud passes as under evaluation (on-call.md §4), with a carrier or without: each message is recorded as
evaluation, not failed, and the check's history shows its recipient, medium and the text it would have sent (api/watch.yamllistCheckEvents, the Watch page of ui.md §3). The messages don't go through the cloud's delivery. No reply reaches Watch, so a failure's rounds go on until it recovers or is paused. -
Numbers. Watch sends from its own numbers for the tenant, each serving one tenant only; vendor operators set them at the cloud, which passes them on with the tenant and publishes them to the tenant's people (on-call.md §4). Whether Watch's carrier gives a number per tenant is a claim of the
carriersspike, which has not run (spikes); a tenant without a Watch number of its own in a country is paged from its default number. Watch finds the tenant of a reply by the called number, and the failures sent to the replying number by a keyed hash of it stored with each notification. -
Acknowledgement by SMS reply or keypad 1 during the call. Each failure has a four-digit code, unique among the tenant's failures that aren't recovered, in every message about it. A reply with the code (or the code and
ack) acknowledges that failure if it was sent to that number; a reply without a code (empty orack) acknowledges the newest failure sent to that number. A reply from a number Watch sent nothing to is ignored. A forged sender number can therefore acknowledge a failure (architecture.md §11); the message to the others and the page after 4 hours bound what that gains. Watch acknowledgements are Watch's own: they acknowledge nothing in the cloud, and the cloud's acknowledge nothing at Watch. -
Rotation gone. A check whose rotation is missing from the replica pages its fallback numbers, and its check view says so.
-
Replica validity. A replica entry names the person on call until a hand-over time and the next person until
valid_until, each with an SMS number and a voice number, as the cloud computes them for the hub's fallback cache too (on-call.md §2, on call with numbers). Watch pages the person whose interval contains the current time, by SMS to their SMS number and by voice to their voice number; for a medium the person has no number for, and aftervalid_until, it uses the check's fallback numbers. -
Recovery on the next valid beat → a message "recovered after 37 min" to everyone who was paged.
-
Pause. A check can be paused with a reason and an end, at most 7 days ahead, for planned work. A paused check doesn't fail; the pause and its end are sent to the check's rotation.
-
Flapping guard: after three missing/recovery cycles within an hour, Watch keeps the check failed until it has seen beats for 15 minutes.
-
One evaluator. Every Watch node takes beats, replies and the API and queues the messages they cause, but exactly one evaluates the checks and sends the notifications: the node that holds a Postgres advisory lock on Watch's database, on a session of its own, with the keepalives and the idle timeout of a hub's lock session (architecture.md §4, Takeover), which it pings every second. The others try to take the lock every 10 s. The lock ends with the holder's session (a stopped or hung node, a lost connection, a failover of the database), and the node that takes it next carries on from the database: failures, rounds and notifications are rows, so it sends what is due and nothing that was claimed before.
-
Every transaction of the evaluator runs on the lock's session and first checks that the session holds the lock, so a node that lost it commits nothing more, also before it notices and before another takes it.
-
A notification is claimed in a transaction of its own, then sent, then its outcome recorded (
schema/watch.sqlnotification). A message goes out at most once: a holder that stalls between claim and send may still send it late, and no other node sends it again; one whose outcome its holder never recorded stayssending, and the next round pages again. -
Each round's message is queued once, by the transaction that moves the round on.
-
The acknowledgement, the recovery and a pause cancel the queued messages of the failure's rounds, and a claim cancels a round's message whose failure is acknowledged or no longer open: after the first acknowledgement only the messages claimed before it go out.
-
Every time Watch compares (beats, rounds, pauses, gaps, the time of a heartbeat) is the database's clock, whichever node took the beat or the reply, so the nodes' clocks don't matter.
-
A pass evaluates the checks whose state may change, each in a transaction of its tenant; one query finds them (
schema/watch.sqllookup_checks_due), and a check that is up and beating within its limits costs nothing more. A pass then claims and sends the queued messages that are due, one query finding them across tenants.
models/WatchEvaluatorchecks these rules with the gaps below:NoCommitWithoutLock,MessageSentOnce,RoundQueuedOnce,OneRoundQueued,NoPageAfterAckandMissingOnlyAfterSilence. -
-
Watch's own gaps. The evaluator passes every 10 s and records each pass. When the newest pass is older than 30 s (no node holds the lock, the holder stalled, the database is unreachable), and from the newest pass to the first pass of each new holder of the lock, the time until that pass is a gap, and beats sent in it may not have been received: the database's outage ends the lock's session, so a beat lost in it falls into a gap. After a gap, a check fails as missing only after
interval + gracewithout a beat counted from the gap's end; a synthetic test whose receipt window overlaps the gap is issued again instead of failing; a check that was failed before the gap stays failed. Each gap is recorded with its start and end and counts against Watch's service level (operations.md §9). -
Every state change and delivery is recorded.
-
Audit. Changes to checks, pauses, tokens and acknowledgements are written to Watch's own hash-chained audit log, as the cloud's (compliance.md §3).
3. Independence
| Shared with the cloud? | Watch |
|---|---|
| Hosting provider | No: provider B, two EU locations. |
| DNS | Own zone at another DNS provider. |
| Code | Own binary. Shared crates only for protocol types and the Zitadel login. |
| Deployment | Own pipeline; never released together with the cloud. |
| Carriers | Own carrier account, not used by the cloud. One carrier, without a second to fail over to: its failure together with a customer's outage is a risk Watch accepts, and the vendor watches it with a test message every hour. |
| Data | A rotation replica pushed by the cloud every 5 minutes (rotation, current person and hand-over time, next person, their numbers, valid-until), plus fallback numbers per check. Watch never calls the cloud at runtime. What the cloud may change at Watch, and what Watch does about it: §5. |
| People | The vendor's on-call team operates both; alerts about the cloud also go to the customer's platform rotation. |
The common-mode risk that remains is the vendor itself. Two features let
customers add vendor diversity: push and reverse checks use plain HTTP,
so the same senders and probes can also point at a third-party watchdog; and
the hub can send its heartbeat to an additional third-party URL
(Settings cloud, extraHeartbeatUrl).
4. Network path
The hub reaches Watch through the customer's forward proxy, which is one more component that can fail. Watch treats a missing heartbeat as an alarm whatever the cause, and its messages leave from outside the customer network.
5. Watch and the cloud
Watch runs synthetic checks for every tenant hub and for the vendor's
test hubs. A failure of the vendor test hubs pages the
vendor's on-call team through Watch's carrier; tenants with failed
synthetic checks are informed at the same time, so they know the hub's
local fallback channel is in use (architecture.md §7).
When the cloud's last replica push is more than 15 minutes old, Watch
pages the vendor's on-call team and goes on paging from the replica it
has (§2).
-
One test number. The synthetic tests of all tenants arrive at one number of Watch, so its failure looks like every tenant's. When at least 5 synthetic tests were due in 10 minutes and more than half of them got no receipt, Watch takes its own test number or the cloud's SMS path as the cause: it pages the vendor's on-call team, fails no tenant's check for it and issues those tests again.
-
Installation failures. When a shared installation fails, or provider A with it, the
hubchecks of all its hubs fail within the same minutes. When, of an installation's hubs whosehubchecks aren't paused, at least the larger of 5 and 20 % had theirhubcheck fail within 5 minutes, Watch takes it as a failure of the installation, which lasts until fewer than that share are failed (schema/watch.sqlinstallation_failure):- The first round of a failure of a hub on a shared installation waits 30 s, the spread of the heartbeats, so that Watch sees the installation's other failures before it sends.
- The vendor's on-call team is paged at once, by SMS and voice outside the throttle, in the pass that finds the installation failure, and again every 30 minutes while it lasts; its end is sent by SMS.
- Each tenant of a failing hub still gets its own messages, never suppressed, only after the vendor's page, through the throttle of §2: 10 a second, oldest failure first. Their text says that the provider's installation failed and the provider is paged; a recovery's, that it recovered. A check event of a hub of the installation from 5 minutes before the installation failure to 5 minutes after its end belongs to it.
- While its installation fails, a check pages again every 30 minutes from its first round, not every 5 minutes, with the fallback numbers from the second round; acknowledgement and the page again after 4 hours are as in §2. For 1,000 failing hubs with one person on call each, by SMS and voice, a round is about 2,000 messages, which go out within about 200 s; the next round follows 30 minutes later.
models/WatchInstallationchecksVendorFirst,ThrottledandNotSuppressed. -
The cloud's pushes. The cloud is the only writer of tenants, their roles and numbers, their hubs and the rotation replica (
api/watch.yaml, tagreplica), with what the tenant's and the hub's plans give Watch: whether calls are allowed (§2) and the cadence of the synthetic tests (§1). It sends a change when it happens and everything again with each replica push, every 5 minutes, and a push of a tenant lists its hubs; so a call that Watch missed, a revocation or a decommissioning included, arrives with the next one. Enrolment, revocation and the creation of a tenant don't wait for Watch: the cloud commits, shows on its Hubs page when Watch last confirmed a hub, and Watch follows. Until then a newly enrolled hub's heartbeats are refused, and itshubcheck starts with the first push. -
What the cloud can do to Watch. A cloud that is faulty or taken over could revoke hubs, delete checks or replace the numbers Watch pages. Watch can't tell such a change from a wanted one, so it makes each one known and slows many down: a revocation, a deletion and a change of a hub's rotation or fallback numbers are sent by SMS to the fallback numbers the check had before; and Watch takes at most 20 revocations and deletions of hubs an hour, refuses more and pages the vendor's on-call team.
pushandreversechecks are the tenant's own; the cloud can't change them. -
Tenant states are the cloud's (architecture.md §12): a suspended tenant's checks run and page; a tenant that is deleted in the cloud is deleted at Watch first, with its checks, numbers and audit (compliance.md §5).