staxlens documentation
Choose a version
Version 0.1.x
StaxLens architecture and pipeline #
StaxLens is a small, horizontally-separable pipeline: an agent per host reports to a collector that stores time-series and serves a per-tenant dashboard.
Pipeline #
Agent (per host) ──Bearer token + HMAC──▶ Collector (multi-tenant)
│
├─▶ time-series store (retention + downsampling)
├─▶ dashboard (per tenant)
└─▶ alert routing (webhook / Slack / email)
Agent #
The agent collects CPU, memory, disk, and network metrics using native OS primitives (the same collection approach as StaxSys and StaxMonitor). It evaluates local threshold rules and POSTs signed reports to the collector on a configured interval.
Collector and multi-tenant isolation #
The collector authenticates each request by bearer token and resolves the
token to a tenant. Every stored record and every query is tagged and scoped
by tenantId, so one tenant can never read another’s data. This isolation
contract holds regardless of how the tenant registry is implemented.
In the MVP the tenant registry is a local JSON file managed by
staxlens tenant <id>. In production this is replaced by the account/billing
service; the data-isolation contract stays identical.
Time-series store, retention, and downsampling #
The store keeps one series per tenant per host. A retention window (default 30 days) drops samples older than the window. When a query spans a wide window that would exceed the point budget, samples are bucketed and averaged so the dashboard stays responsive. The aggregate endpoint averages across a tenant’s hosts for a fleet-wide view.
Alerting #
Agents evaluate rules locally and attach triggered alerts to their report. The collector routes each alert to the configured channels (webhook, Slack, email via relay). Alerts are tenant-scoped.
Limitations (MVP) #
- Single-node collector; no replication or horizontal scaling yet.
- Tenant registry is file-based; production uses the account/billing service (per-node subscription, self-hosted license).
- No native SMTP; email alerts go through an external
relayUrl. - “Hosted” is a deployment choice — the same software runs self-hosted.