Skip to content
steliosxPublic

About

A Rust rewrite of the Alerta alert-management server (early alpha), and measured ways to make stock Alerta faster

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1,209 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

alrust

alrust

An alert aggregation and deduplication server: a Rust rewrite of Alerta on PostgreSQL. Its goal is to be API-compatible with the Alerta API as the Alerta web UI and existing scripts use it, and to run on Alerta's own database layout.

Project stage: early alpha. The Rust API server runs and speaks the core of the Alerta v9.1.0 API. It is built to be tried, not yet to replace an Alerta server. Full parity with Alerta is not claimed; the limitations are listed.

Do you run Alerta today? This project measured ways to make stock Alerta 9.1.0 faster, with configuration, PostgreSQL and one add-on file. Alerta's own files stay as released. Start here:

A summary is below.

Project website · Quick start · Tuning stock Alerta · What works · Not yet · Performance · Architecture · Roadmap · Contributing · Licensing


Quick start

You need Docker with the compose plugin on an x86_64 (amd64) host.

git clone https://github.com/steliosx/alrust.git
cd alrust
export ALRUST_ADMIN_KEY=$(openssl rand -hex 20)   # your admin API key
docker compose up --build -d
curl http://localhost:8080/management/gtg          # -> OK

Send an alert and read it back:

curl -s -X POST http://localhost:8080/alert \
  -H "Authorization: Key $ALRUST_ADMIN_KEY" -H 'Content-Type: application/json' \
  -d '{"resource":"web01","event":"HttpError","environment":"Production",
       "service":["Web"],"severity":"major","text":"500 on /login"}'

curl -s -H "Authorization: Key $ALRUST_ADMIN_KEY" http://localhost:8080/alerts

The alpha guide has the rest: running without Docker, every configuration variable, the end-to-end smoke script and the known gaps. Use a disposable database for a trial.

What works

Area State
Alerts Receive with deduplication and correlation, the reference status and severity state machine, status changes, actions (ack, shelve, close and the others), tags, attributes, delete, history
Queries GET /alerts and /alerts/count with the common filters, exclusions and paging
Heartbeats Create or update, list, get, delete
API keys Create, list, delete; scopes; customer assignment
Authentication API keys, and verification of HS256 Bearer tokens. There is no login yet
Housekeeping Expiry and deletion, on request or on an interval
Database PostgreSQL 18.7 only. alrust uses the Alerta 9.1.0 schema exactly: it creates it in an empty database, or accepts an existing Alerta 9.1.0 database whose schema matches
Packaging A Dockerfile and a Compose file for linux/amd64

The route-by-route list, with each known difference from Alerta, is in the alpha guide.

Not yet

  • Blackouts, notes, customers, users, groups and permissions routes.
  • Logins (basic, LDAP, OIDC, SAML). API keys are the working credential.
  • Webhook receivers (Zabbix, Grafana, Prometheus and the others) and outbound notifications.
  • Bulk routes, top-N counts, q= queries and regex filters.
  • The web UI and the desktop app. webui/ and desktop/ are placeholders.
  • ARM64 builds.
  • Qualification against Alerta. The comparison suite in conformance/ has not completed a full run against both servers: all 19 runtime profiles are NOT_RUN. The status record has the exact evidence.

Performance

A replay of the benchmark's single-client rates: alrust's bars fill several times faster than Alerta's for a list, a count and a duplicate write

A diagnostic benchmark compared alrust with Alerta 9.1.0 on one GitHub-hosted runner (4 vCPUs, PostgreSQL 18.7, 1,000 synthetic alerts), with one client waiting for each answer. The animation replays the measured rates; it is not a recording. Alerta's time per request, as a multiple of alrust's:

Request Alerta, 1 worker Alerta, PgBouncer and 4 workers
List the 50 newest alerts 5.5–5.6× 4.3–4.5×
Count alerts by severity and status 14–17× 10–13×
Receive a duplicate alert 15–17× 11–13×

Each range comes from two runs on different runners. Every server's single-client latency was 37% to 77% higher on the second runner (most on alrust's sub-millisecond requests); the ratios differed less.

Why, as measured:

  • CPU per request. With one client, Alerta's Python process used about 7.5 times (list), 28 times (count) and 20 times (duplicate write) the CPU alrust used per request. With one client, a pooler and more workers left this about the same.
  • A database connection per request. Alerta opens and closes a PostgreSQL connection for every request; alrust keeps a pool of connections. On the list, PostgreSQL used about 5.5 ms less CPU per request with PgBouncer in front of Alerta. That difference includes the connection's start and authentication, but does not measure them alone. PgBouncer narrows the gap (the right-hand column), but the gap remains.

Why, read from the code: a list request costs Alerta about seven database round trips and alrust three. Alerta also builds and serializes Python objects, where alrust uses compiled code.

Limits: one machine at a time, synthetic data, and a write case that covers duplicates only. The duplicate-write ratios are diagnostic: those runs predate the check that every write was saved. At eight clients the bottleneck was not isolated, so eight-client figures are not compared. This is not a capacity claim. Details, the raw results and the harness are in the benchmark report. An independent run on an 8-vCPU machine (#255) measured similar single-client ratios.

Making stock Alerta faster

The project also measures how far Alerta 9.1.0 as released can be sped up, with configuration, PostgreSQL and one add-on file, at one site and at two data sites. Alerta's own files stay as released; the add-on, alerta_fast.py, replaces a few of Alerta's functions when the server starts. The main results so far:

If you run Alerta… Change Measured change Limits Report
With the default PLUGINS and no forwarding Remove forwarder from PLUGINS +8% to +11% duplicate writes per second on stock Alerta; +39% to +45% with the add-on's safe patches in both arms (8 clients) One fixed duplicate alert was sent. Check first that FWD_DESTINATIONS is empty (the plugin also forwards actions and deletes), that nothing relies on its loop check (X-Alerta-Loop), and that no UPDATE trigger on alerts depends on the writes it causes tuning, fastpath
Directly on PostgreSQL Put PgBouncer in front (TCP with SCRAM) +18% to +39% requests per second in the tested list, count and duplicate write, against Alerta directly on PostgreSQL 1,000 alerts, 4 workers of 4 threads, forwarder in place tuning
With forwarder and a large alerts table Test the ID prefix index on a copy first 100,000 alerts: +193% to +282% duplicate writes per second on stock Alerta; reads no clear change A C.UTF-8 database; building the index on a live table was not measured index
At two sites with one PostgreSQL primary Send each site's requests to the Alerta at the primary's site Site B median duplicate write in each of three blocks, 50 ms link: 971–977 ms → 61–63 ms The add-on's safe patches in both arms; site A primary and both sites healthy. Failover, fallback and recovery were not tested two-site
With dashboards that repeat searches The add-on's opt-in savedq Server CPU per request −73% for one recurring search Only for Alerta's stock PostgreSQL search grammar: if your code changes it, leave savedq off, or call alerta_fast.savedq_disable() in each worker before its first request. +2% to 3% CPU when every search text is new savedq

These numbers come from GitHub-hosted runners with synthetic alerts (the two-site run used emulated links on one machine). They are diagnostic, not a capacity claim. Read the operator guide before you change anything, and test on a copy first (Measure your own Alerta, safely). All findings, with charts: Making Alerta faster: what we measured.

For example, at two sites with a 50 ms link, site B's requests were much faster when HAProxy sent them to the Alerta at the PostgreSQL primary's site:

Site B median time per request with a 50 ms link. Site B's own Alerta: list 459 to 464 ms, count 410 to 414 ms, duplicate write 971 to 977 ms. Alerta at the primary's site: list 103 to 104 ms, count 56 ms, duplicate write 61 to 63 ms.

Architecture

alrust-engine is a pure library with no I/O: it computes lifecycle decisions. The API layer does the orchestration, and reads and writes PostgreSQL through alrust-store-pg.

flowchart LR
    C[Scripts and monitoring systems] -->|Alerta HTTP API| A
    subgraph srv [alrust server]
        A["alrust-api: Alerta-compatible HTTP, orchestration"] -->|calls| E["alrust-engine: pure library, no I/O - dedup, correlate, lifecycle"]
        A -->|reads and writes| S[("alrust-store-pg: PostgreSQL, Alerta schema")]
    end
    R[alrust-receivers: webhooks] -.->|planned| A
    W[Alerta web UI, vendored] -.->|planned| A
    D[Tauri desktop app] -.->|planned| W
Loading
Crate Role
alrust-domain Types shared by the others
alrust-engine Lifecycle decisions; no I/O
alrust-store-pg PostgreSQL store, schema creation and adoption
alrust-api HTTP routes and authentication
alrust-server The alrust binary: configuration and start-up
alrust-receivers Webhook receivers (empty for now)

Compatibility is judged against pinned upstream releases, kept as read-only submodules under reference/: alerta v9.1.0 and alerta-webui v8.7.1. The behaviour specifications taken from that source are in spec/.

Roadmap

The plan is the project kickoff. The server was built ahead of the Phase 0 gate by owner decision ("alpha first"), so several phases are partly done at once.

Phase Scope State
0 Specifications from the upstream source; conformance suite Specifications written. Gate open: no full suite run against the reference in CI
1 Domain model, pure lifecycle engine, PostgreSQL store In the alpha. Gate open: property tests and full spec vectors
2 HTTP API with the query grammar; server-sent events Core routes in the alpha. No SSE, no q= grammar, no conformance result
3 API keys and OIDC for operators API keys and Bearer verification in the alpha. No login
4 Zabbix receiver, generic webhook mapper, outbound forwarder Not started
5 Housekeeping, heartbeat alerts, metrics, Docker, shadow-run tooling Housekeeping and Docker in the alpha. The rest not started
6 Tauri desktop apps for Windows and macOS Not started

Contributing

See CONTRIBUTING for how to set up a checkout, run the checks and propose a change. In short:

cargo fmt --all --check
cargo clippy --locked --workspace --all-targets -- -D warnings
cargo test --locked --workspace

Behaviour must match the pinned upstream release. An intended difference in alert lifecycle, authentication or data retention is recorded in DECISIONS or an ADR under docs/adr/. Each change is written by one party and reviewed at its exact commit by another before it is merged. Releases, repository settings and security decisions belong to the repository owner.

Licensing

  • alrust is licensed under the Apache License, Version 2.0 (owner decision, DECISIONS Y58). See NOTICE for the parts derived from Alerta and their attribution.
  • Third-party Rust dependencies keep their own licences; see THIRD_PARTY_NOTICES.
  • The upstream Alerta sources that alrust is checked against keep their own licences, and vendored code keeps its notices:

About

A Rust rewrite of the Alerta alert-management server (early alpha), and measured ways to make stock Alerta faster

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages