Only cmd/api talks to Postgres and Redis. Checkers and status page servers are agents: they authenticate with a token from api agent create and use the versioned agent API under /agent/v1. Cloud, hybrid and self-hosted deployments now share one protocol.
Per region, a Redis sorted set holds each monitor's next run.
Every API replica runs the dispatcher; a Lua script atomically hands due runs to a randomly chosen live checker instance of the region and schedules the next run, so no leader is needed and lost jobs never stop a monitor.
Any number of checker instances can share a region and token. Instances long-poll for jobs (doubling as heartbeat); jobs of instances silent for 45 s, or that shut down gracefully, go to the remaining ones.
A minute-ly reconciliation repairs Redis against the database.
HTTP(S) with expected status, keyword present/absent, redirects, TLS verification and headers; TCP; TLS certificate expiry; DNS (A, AAAA, CNAME, MX, NS, TXT, custom resolver, expected answer); ICMP over unprivileged sockets. Targets on private networks are refused for operator checkers in the cloud edition.
Monitors and region assignments under row-level security.
check_results hypertable with compression after 7 days, 90-day retention, hourly and daily continuous aggregates (real-time). It has no row-level security because TimescaleDB refuses compression and continuous aggregates on such tables; every results query takes org_id, enforced by a test.
API
/api/v1/org/monitors CRUD (monitors.read / monitors.write), /api/v1/regions with live instance counts. Operator CLI: api region add, api agent create|list|revoke.
Breaking
cmd/checker and cmd/statuspage need UPTIME_API_URL and UPTIME_AGENT_TOKEN instead of database and Redis settings; the checker's region comes from its token.
Testing
internal/api/checker_test.go runs the API with three in-process checkers in two regions against a local target: random distribution within a region, region isolation, failure reporting, handover when an instance stops. Integration tests now use a separate uptime_test database and run with go test -p 1.
Milestone M4: monitors, checks and distributed checking. Stacked on #47 (M3); merge that first.
## Architecture change (#49)
Only `cmd/api` talks to Postgres and Redis. Checkers and status page servers are agents: they authenticate with a token from `api agent create` and use the versioned agent API under `/agent/v1`. Cloud, hybrid and self-hosted deployments now share one protocol.
## Scheduling (#11)
- Per region, a Redis sorted set holds each monitor's next run.
- Every API replica runs the dispatcher; a Lua script atomically hands due runs to a **randomly chosen live checker instance of the region** and schedules the next run, so no leader is needed and lost jobs never stop a monitor.
- Any number of checker instances can share a region and token. Instances long-poll for jobs (doubling as heartbeat); jobs of instances silent for 45 s, or that shut down gracefully, go to the remaining ones.
- A minute-ly reconciliation repairs Redis against the database.
## Checks (#12)
HTTP(S) with expected status, keyword present/absent, redirects, TLS verification and headers; TCP; TLS certificate expiry; DNS (A, AAAA, CNAME, MX, NS, TXT, custom resolver, expected answer); ICMP over unprivileged sockets. Targets on private networks are refused for operator checkers in the cloud edition.
## Data (#10, #13)
- Monitors and region assignments under row-level security.
- `check_results` hypertable with compression after 7 days, 90-day retention, hourly and daily continuous aggregates (real-time). It has **no** row-level security because TimescaleDB refuses compression and continuous aggregates on such tables; every results query takes `org_id`, enforced by a test.
## API
`/api/v1/org/monitors` CRUD (`monitors.read` / `monitors.write`), `/api/v1/regions` with live instance counts. Operator CLI: `api region add`, `api agent create|list|revoke`.
## Breaking
`cmd/checker` and `cmd/statuspage` need `UPTIME_API_URL` and `UPTIME_AGENT_TOKEN` instead of database and Redis settings; the checker's region comes from its token.
## Testing
`internal/api/checker_test.go` runs the API with three in-process checkers in two regions against a local target: random distribution within a region, region isolation, failure reporting, handover when an instance stops. Integration tests now use a separate `uptime_test` database and run with `go test -p 1`.
Closes #10, #11, #12, #13, #49
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Sebi
added this to the M4 Checker milestone 2026-11-22 00:13:31 +00:00
check_results has no row-level security because TimescaleDB refuses
compression and continuous aggregates on such tables. Every results
query takes org_id as a parameter, which a test enforces.
Refs #10, #13
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Only cmd/api connects to Postgres and Redis. Agents authenticate with
tokens created by 'api agent create' and use /agent/v1: checkers long
poll for jobs, which doubles as heartbeat, and report results in
batches. Organizations manage monitors through /api/v1/org/monitors.
BREAKING CHANGE: cmd/checker and cmd/statuspage no longer read
UPTIME_DATABASE_URL or UPTIME_REDIS_*; they need UPTIME_API_URL and
UPTIME_AGENT_TOKEN. UPTIME_CHECKER_REGION is replaced by the region bound
to the agent token.
Closes#10Closes#11Closes#12Closes#13Closes#49
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Milestone M4: monitors, checks and distributed checking. Stacked on #47 (M3); merge that first.
Architecture change (#49)
Only
cmd/apitalks to Postgres and Redis. Checkers and status page servers are agents: they authenticate with a token fromapi agent createand use the versioned agent API under/agent/v1. Cloud, hybrid and self-hosted deployments now share one protocol.Scheduling (#11)
Checks (#12)
HTTP(S) with expected status, keyword present/absent, redirects, TLS verification and headers; TCP; TLS certificate expiry; DNS (A, AAAA, CNAME, MX, NS, TXT, custom resolver, expected answer); ICMP over unprivileged sockets. Targets on private networks are refused for operator checkers in the cloud edition.
Data (#10, #13)
check_resultshypertable with compression after 7 days, 90-day retention, hourly and daily continuous aggregates (real-time). It has no row-level security because TimescaleDB refuses compression and continuous aggregates on such tables; every results query takesorg_id, enforced by a test.API
/api/v1/org/monitorsCRUD (monitors.read/monitors.write),/api/v1/regionswith live instance counts. Operator CLI:api region add,api agent create|list|revoke.Breaking
cmd/checkerandcmd/statuspageneedUPTIME_API_URLandUPTIME_AGENT_TOKENinstead of database and Redis settings; the checker's region comes from its token.Testing
internal/api/checker_test.goruns the API with three in-process checkers in two regions against a local target: random distribution within a region, region isolation, failure reporting, handover when an instance stops. Integration tests now use a separateuptime_testdatabase and run withgo test -p 1.Closes #10, #11, #12, #13, #49
🤖 Generated with Claude Code
https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3