Quality System Built on ClickHouse & Grafana, With Eval Results
Many teams treat test results like a checkbox: green ships, red blocks. The useful signal lives between those states: runtime variance, retry counts, the same handful of tests that show up in every postmortem. Getting at it needs a data layer fast enough to query millions of test executions without waiting for an overnight BI job.
ClickHouse and Grafana are a credible answer. ClickHouse's columnar storage suits append-only execution records, and Grafana puts the queries in front of the people who own the tests. The same pairing also handles a newer kind of result. Suites that exercise agents and LLM features produce pass rates over repeated runs, scores and judge verdicts, all tied to a model and prompt version. Those belong in the same warehouse, but not in the same rows or the same metric as ordinary pass/fail.
This article covers ClickHouse as a test execution warehouse, a schema and ingestion path from JUnit XML, the flakiness query and Grafana panel, where the stack breaks under real CI load, how to extend it for agent eval results, and what a dashboard cannot fix on its own.
Learn Node.js, Cucumber, GitHub Copilot, APIs, CI/CD, and modern automation by building a complete framework.
ClickHouse as a Test Execution Warehouse
ClickHouse is an OLAP database optimized for append-only, high-cardinality time-series data — exactly the shape of test execution records. Each row is a test run: test name, suite, branch, commit SHA, status, duration, retry count, CI job ID, timestamp. You never update rows; you insert them and query aggregates. That append-only pattern eliminates the write contention that makes PostgreSQL painful at scale and keeps ingestion simple enough to drive directly from a JUnit XML parser or an OpenTelemetry exporter.
In a modern quality architecture, ClickHouse sits between your CI layer (GitHub Actions, Buildkite, Argo Workflows) and your visualization layer (Grafana). It is not a test management tool — it doesn't replace Allure for per-run artifact storage or a system like a fully designed quality architecture for test case governance. Its role is narrow and valuable: durable, queryable storage for execution telemetry at a scale and query speed that transactional databases can't match without significant sharding effort.
Schema, Ingestion, and Closing the Loop in Quality Improvement
Start with a schema that encodes the dimensions you'll actually filter on. Partition by month; order by (suite, test_name, started_at) so range scans on a single test's history are sequential reads.
CREATE TABLE test_executions
(
run_id UUID,
suite LowCardinality(String),
test_name String,
status LowCardinality(String), -- passed | failed | skipped | flaky
duration_ms UInt32,
retry_count UInt8,
branch LowCardinality(String),
commit_sha FixedString(40),
job_id String,
started_at DateTime
)
ENGINE = MergeTree()
PARTITION BY toYYYYMM(started_at)
ORDER BY (suite, test_name, started_at)
SETTINGS index_granularity = 8192;
Ingestion from JUnit XML is straightforward with a small Python script that parses testsuites → testcase elements and bulk-inserts via clickhouse-driver. Wire it as a post-step in your GitHub Actions workflow so every CI run ships its results within seconds of completion.
# .github/workflows/ci.yml (post-test step)
- name: Ship test results to ClickHouse
if: always()
run: |
python scripts/ingest_junit.py \
--xml-glob "reports/**/*.xml" \
--ch-host ${{ secrets.CH_HOST }} \
--branch ${{ github.ref_name }} \
--commit ${{ github.sha }}
Once data is flowing, the queries that matter most are flakiness rate and runtime drift. The flakiness query below counts passes that needed a retry, which means the test failed and then passed within the same job — a stronger signal than a simple failure count.
-- Flakiness rate over the last 14 days, by test
SELECT
test_name,
countIf(status = 'failed') AS failures,
countIf(retry_count > 0 AND status = 'passed') AS flaky_recoveries,
round(flaky_recoveries / (failures + flaky_recoveries) * 100, 1) AS flakiness_pct,
avg(duration_ms) AS avg_duration_ms
FROM test_executions
WHERE started_at >= now() - INTERVAL 14 DAY
AND branch = 'main'
GROUP BY test_name
HAVING flakiness_pct > 5
ORDER BY flakiness_pct DESC
LIMIT 50;
In Grafana, point a ClickHouse data source (the Altinity or Grafana-maintained plugin both work; pin to a specific version to avoid breaking schema changes) at this query and set the panel refresh to 5 minutes. Engineers can then filter this panel by branch and suite directly in Grafana rather than grepping CI logs. For teams already routing Grafana alerts to incident channels, wiring Slack notifications from this dashboard is a natural next step that closes the feedback loop to the engineers who own the flaky tests.
// Grafana panel JSON (partial) — ClickHouse data source
{
"type": "table",
"title": "Top Flaky Tests — Last 14 Days",
"datasource": { "type": "vertamedia-clickhouse-datasource", "uid": "clickhouse-prod" },
"options": { "sortBy": [{ "displayName": "flakiness_pct", "desc": true }] },
"fieldConfig": {
"overrides": [{
"matcher": { "id": "byName", "options": "flakiness_pct" },
"properties": [{ "id": "thresholds",
"value": { "steps": [
{ "color": "green", "value": null },
{ "color": "yellow", "value": 5 },
{ "color": "red", "value": 20 }
]}}]
}]
}
}
Where This Stack Breaks Under Real CI Load
Ingestion fan-out at scale. When 50 parallel CI jobs each open a ClickHouse connection and insert synchronously, you hit connection limits fast. The fix is a lightweight buffer: write JUnit results to an S3 bucket or a Kafka topic and run a single consumer that batch-inserts. ClickHouse's native bulk insert (HTTP interface with FORMAT JSONEachRow) handles large batched inserts comfortably — the bottleneck is almost always the producer side, not the database. Teams skip the buffer because it feels like over-engineering; they regret it at 200+ concurrent jobs.
Cardinality creep in test_name. Parameterized tests that embed dynamic values — timestamps, UUIDs, random seeds — in their display names will shred your aggregations and balloon storage. Enforce a normalization step in the ingestor that strips or hashes dynamic segments before insert. This is an org-level discipline problem as much as a tooling one: test authors don't think about downstream analytics when they name a test test_checkout[user_id=8a3f…]. A linter in CI that rejects test names matching a UUID pattern catches this before it hits the warehouse.
Extending the warehouse for agent evals and model-calling tests
A model-calling test does not have one outcome per commit; it has a pass rate over N runs, and that rate means nothing without the model and prompt version that produced it. Squeezing those runs into test_executions makes the flakiness query flag every eval as flaky and hides the real flakes. Give them their own table, one row per run:
CREATE TABLE eval_runs
(
eval_suite LowCardinality(String),
case_id String,
run_index UInt16,
passed UInt8,
score Nullable(Float32), -- judge or metric score, if any
model LowCardinality(String),
prompt_version LowCardinality(String),
judge_model LowCardinality(String), -- empty when the check is deterministic
commit_sha FixedString(40),
started_at DateTime
)
ENGINE = MergeTree()
PARTITION BY toYYYYMM(started_at)
ORDER BY (eval_suite, case_id, started_at);
-- Pass rate per case, per model and prompt version
SELECT eval_suite, case_id, model, prompt_version,
count() AS runs,
round(avg(passed) * 100, 1) AS pass_rate_pct
FROM eval_runs
WHERE started_at >= now() - INTERVAL 14 DAY
GROUP BY eval_suite, case_id, model, prompt_version
ORDER BY pass_rate_pct ASC;
In Grafana, chart pass rate per case over time with the threshold drawn on the panel, and split series by prompt_version, so a regression lines up visibly with the change that caused it. If an LLM judge grades some cases, keep a small human-graded sample in the same table with judge_model = 'human' and chart the agreement between judge and human; a judge that drifts makes every score it touches unreliable.
One more column earns its place in test_executions: whether a coding agent created or last changed the test, taken from a commit trailer or the PR author. With it you can see whether agent-written tests flake more often in your codebase instead of guessing. For flake-versus-probabilistic reporting in more depth, see auto-detecting flaky tests in CI.
Quality Engineering in 2026: What This Stack Doesn't Fix
A fast dashboard is not a quality system. ClickHouse and Grafana give you visibility — they don't give you ownership, triage workflow, or remediation tracking. Teams that stop at the dashboard layer end up with beautiful charts nobody acts on. A complete quality system needs test case governance (where tools like those built around ReportPortal add value), clear ownership assignment, and a feedback mechanism that routes failures to the right team automatically. The analytics layer informs those decisions; it doesn't replace them. Tracking quality trends over time without vanity metrics requires that the humans reading the dashboard have agreed on what "improving" actually means.
Pass rate is not a quality signal. A suite that passes 99% of the time while silently skipping 30% of its tests is not healthy. The metrics that matter are flakiness rate, mean time to detection, retry-adjusted failure rate, and duration P95 trend — not raw pass percentage. ClickHouse makes it easy to compute all of these; the mistake is defaulting to the aggregate pass rate because it's the first column in the JUnit XML summary and it fits on a single gauge panel. Build the harder queries first, even if they take longer to explain to stakeholders.
ClickHouse and Grafana form a capable, cost-effective analytics backbone for quality engineering — but only if the schema is designed for the queries you actually need and ingestion is treated as a first-class pipeline, not an afterthought. Start with the flakiness and duration-drift queries above, instrument one suite end-to-end, and validate that the numbers match your intuition before expanding. Once the data layer is stable, the harder work — ownership, triage process, and acting on what the dashboard tells you — is what separates teams that improve from teams that just observe.
Note: This article is for informational purposes only and is not a substitute for professional advice. If you need guidance on specific situations described in this article, consider consulting a qualified professional.