Repository navigation
feat(ci): materialize CI runs and jobs off github-actions traces - #1718
Conversation
ci_runs and ci_jobs keep one row per workflow run and per job with the cicd.* attributes as columns, for a year. The CI analytics read raw traces today and scan every step span's Map columns: a page load on a busy org read 1.3-9.8 GB. Migration 0047 creates both, their views, and backfills the retained traces without doubling rows the views write meanwhile.
Maple review🟢 Confidence 10/10 · safe to merge Adds migration 0047:
Before merge
Production impactOpen errors in the changed files
After this merges, Maple checks whether they stop. What was checked
Observability coverage: 1 of 1 changes observable
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 50 minutes. View limit details
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Merged with 2 steps from "Before merge" still open. If they are done, tick them on the review comment; if not, now is the time.
|
Maple: after this shipped✅ Shipped clean. Nothing this change touches got worse in the hour after it deployed. Deployed to Errors in the changed files:
Maple looks once, an hour after the first deploy that carries the merge. |
What
Two filtered projections of the
github-actionsCI traces, one row per workflow run (ci_runs) and one per job (ci_jobs), with thecicd.*attributes as columns and a 365-day TTL. Migration 0047 creates them and their views, then backfills the retained raw traces. Nothing reads them yet; the next PR moves the CI analytics over.Why
The CI page's queries read raw
tracesand pull every field out of the Map columns. Measured in prod on Maple's own org: a 6-day job query reads 569k rows / 205 MB to count 22k jobs, and the same kind of scan over 30 days took 16 s (cold) against 181 ms (warm). In the app that showed up as p95 3 to 4.4 s and spikes to 15.7 s per query, with 11 queries per page load in three waves.Step spans are 80% of CI spans and no CI query reads them; runner-wait spans duplicate the queue time the job span already carries. The projections keep runs and jobs only.
Layout, chosen by benchmark
Real CI span shapes, synthetic volume: a Maple-sized org (790 runs/day) and a 10x org over 365 days, plus 9M non-CI spans in raw
traces. ClickHouse 25.8, 2 threads,bun run bench:queries, 7 runs.(OrgId, Timestamp, TraceId), monthly partitions(OrgId, Owner, Repository, Pipeline, Timestamp)Rows: 88 B per run and 55 B per job compressed on synthetic ids (real ids compress better).
Safety
(TraceId, SpanId)its target already holds, so the spans the views write while it runs are never doubled, and a replay keeps the rows older than raw retention. Nothing is truncated:ci_*outlive their source by 335 days. The convergence gate inmigrations/index.test.tsnow accepts that guard.requiredForIngest: false; ingest readiness is unaffected.traceson deploy. The views filterServiceName = 'github-actions', the second sort-key column, so each org's replay reads only its CI granules (Maple's own org: ~450 MB over 30 days).Verification
ci-runs.clickhouse.e2e.test.tson ClickHouse 25.8 and 26.2: CiTraceService-shaped spans land exactly (steps, runner waits and other services excluded; skipped runs kept), the backfill rebuilds the same rows without doubling the views' rows, and a full replay keeps a run older than raw retention. A mutation (putting a TRUNCATE back) fails it.clickhouse:schema:check,tinybird:manifest:check, domain (169), CLI (626) tests, scoped typecheck and effect lint.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Stack: #1718 (tables) → #1719 (reads) → #1720 (one-year range)
Stack: #1718 (tables) → #1719 (reads) → #1720 (one-year range)
🤖 Generated with Claude Code
Summary by CodeRabbit