Adds the Kura node usage tracking pipeline (node rollups → ClickHouse) and an account-scoped Usage dashboard so customers and Tuist can see what each managed Kura mesh moves. The plumbing pieces (node-side rollups, internal ingestion endpoint, control-plane auth) and the dashboard are split into two commits for review.
Summary
- Ingestion (
feat(kura,server): record per-tenant Kura node usage rollups) — Kura nodes now aggregate per-tenant traffic into hourly rollups (bytes, request count, direction, operation, region) and POST them to an internal Tuist endpoint. Server side adds the kura_usage_events ClickHouse table + a daily aggregating materialized view, a shared-secret-authenticated internal controller, Tuist.Kura.Usage.create_events/1, and Helm/secret wiring for the new shared secret. data-export.md updated.
- Dashboard (
feat(server): add Kura usage dashboard) — New /<account>/usage LiveView under the account layout with three clickable widgets (Egress / Ingress / Requests) that switch the chart series, a per-region time-series chart, a per-node breakdown table, and project + date-range filters. Gated by a new FeatureFlags.kura_enabled?/1 so the sidebar entry and the page only show when Kura is enabled for the account. Read queries live in Tuist.Kura.Usage and run against ClickHouseRepo.
- Local dev —
priv/repo/seeds.exs now emits 30 days of synthetic hourly Kura usage events across four nodes in three regions for two projects, with realistic egress/ingress asymmetry, so the dashboard renders non-empty after seeding.
How to test locally
# Bootstrap the dev stack
brew services start postgresql@16
mise run clickhouse:start
mise install
mise run db:reset # picks up the new kura_usage_events migration
# Seed Kura usage events alongside the rest of the dev data
cd server
mix run priv/repo/seeds.exs
# Start the dev server and log in as tuistrocks@tuist.dev / tuistrocks
mise run dev
Then visit http://localhost:8080/tuist/usage and:
- Confirm the Usage sidebar entry only appears for accounts with Kura enabled (dev mode auto-enables it).
- Click each widget (Egress / Ingress / Requests) and watch the chart series + y-axis formatter swap.
- Switch the project filter between
Any, tuist, and android; switch the date range between 24 hours / 7 days / 30 days and confirm the bucket flips between hourly and daily resolution.
- Confirm the per-node table shows Egress and Ingress bytes columns and that totals are sorted by combined bytes desc.
Ingestion side:
# Ingestion controller tests
cd server
mix test test/tuist_web/controllers/internal/kura_usage_controller_test.exs
# Full Kura module tests
mix test test/tuist/kura_test.exs