Delivery metrics
Optional: hand this page to your coding agentThe steps work by hand too.Show the whole prompt
Read https://intentius.io/terragucci/reference/delivery-metrics/.
Download dora.json from the top of my reports prefix with a read-only identity, validate it against
the JSON Schema the page names, and tell me, per project, the deployment frequency, the lead time with
its split, the change failure rate and the time to restore, and which weeks moved most.
Read only: write nothing to the bucket.
Never apply, approve (a pull request review or `terragucci approve`), override a policy denial (`terragucci override`), use `--mode apply`, or merge; never touch `.chant/allowed_signers` or `chant/lifecycle`.terragucci estate reads the audit trail (audit.jsonl) and each project’s index.json from your bucket. It writes the four DORA metrics for each project and the whole estate to dora.json beside estate.json and to the Delivery section of estate.html.
The metrics
Section titled “The metrics”| Metric | terragucci counts | From |
|---|---|---|
| Deployment frequency | applied waves per week | apply entries with result applied in audit.jsonl |
| Lead time | the median time from a change’s first plan to its wave applied, split in three (below) | tf-plan rows in index.json, and the approval-requested, approval and apply entries in audit.jsonl |
| Change failure rate | failed applies, plus applied waves whose roots drifted within 7 days, over all applies | apply entries with result failed, and tf-drift rows that found drift |
| Time to restore | the median time from a failed apply to the next apply of those roots, and from drift found to the next drift check that found none | apply entries, and tf-drift rows |
A refused wave is the gate working, so it is neither an apply nor a failure. Until its approval, a waiting wave is not an apply either.
Infrastructure ships less often than an application. The page shows frequency per project as a trend and never rates a project against DORA’s performance tiers.
The window
Section titled “The window”Every number covers the newest eight weeks (Monday to Sunday in UTC, current week included). Each week also has its own row, trend in dora.json, with the same counts for that week alone.
The deployment rate divides by the span the history covers, not by eight weeks. The span runs from when terragucci estate ran back to the oldest apply on record, or back to the window’s start when the record is older, and is at least a day. A project whose first apply was 32 hours ago reads its applies per week over those 32 hours, and a project that stopped deploying keeps counting the weeks since. The page names the span beside each rate (“12 in 32 hours”, “20 in 7.4 weeks”), and dora.json holds it as span_seconds. With no apply on record, the span is the window.
Lead time, change failure rate and time to restore are medians and ratios of what the window holds. A short history gives them fewer samples, but no weeks it never had.
Lead time and its split
Section titled “Lead time and its split”Lead time starts at the first plan. terragucci finds the plan of an applied wave by its commit, or by the wave’s digest: a tf-plan row lists each wave’s set digest and review digest (wave_digests), and a merge commit’s wave binds the same digest its pull request planned. The clock then starts at the first plan of that pull request.
| Part | From | To |
|---|---|---|
| before the gate | the first plan | the wave asking for an approval; the apply when no gate held the wave |
| at the gate | the wave asking for an approval | the approval |
| after the gate | the approval | the wave applied |
Without a plan in the index, an applied wave has no lead time. The page shows the median of the total and of each part, so the three parts need not add up to the total.
Change failures and restores
Section titled “Change failures and restores”An applied wave counts as failed when its roots drift within 7 days and no later apply of those roots came first. A tf-drift row lists the roots that drifted (drifted_roots). Rows written before that field existed match any root of their project.
| Event | Incident | Field |
|---|---|---|
| an apply fails | opens one for the roots it failed on | |
| another failure of roots already failing | joins the open incident | |
| an apply applies each of those roots again | closes the apply’s incident | |
| the first drift check that finds drift | opens a drift incident, as the drift issue does | drift_since on the tf-drift row |
| the next drift check that finds none | closes it | drift_cleared on that row |
Checks of the same commit share one row of the index, so each tf-drift row carries the open drift forward. restore.open counts the incidents still open.
Requirements
Section titled “Requirements”| Record | Without it |
|---|---|
audit.jsonl |
no apply counts: deployments, lead time and failed applies are zero, and the page says so. Run terragucci audit before terragucci estate. |
tf-plan rows in each index.json |
no lead time |
tf-drift rows |
no drift counts as a failure or a restore |
An index keeps its newest 500 rows. Plans and drift checks older than that drop out of the lead time and the drift counts; the audit trail keeps every apply.
dora.json
Section titled “dora.json”dora.json is terragucci.dora/v1, with its JSON Schema in the package as dist/dora.schema.json.
| Field | What it holds |
|---|---|
generated |
when it was built |
weeks, window |
how many weeks it covers, and the first Monday and the end |
drift_window_seconds |
how soon after an apply drift counts against it |
audit |
whether audit.jsonl was read |
estate |
the metrics across every project |
projects[] |
each project’s metrics, with project |
Each set of metrics holds:
| Field | What it holds |
|---|---|
deployments, per_week, span_seconds |
applied waves in the window, per week, and the span in seconds the rate divides by |
lead_time |
changes counted, median_seconds, and the split as before_gate_seconds, at_gate_seconds and after_gate_seconds; null when nothing counts |
change_failure |
applies, failed, drifted and rate; rate is null with no applies |
restore |
restored, open, median_seconds, and how many restores were of applies and of drift |
trend[] |
a row per week, oldest first: week, deployments, applies, failures, lead_time_seconds, restore_seconds |
Gauges
Section titled “Gauges”With OTEL_EXPORTER_OTLP_ENDPOINT (or the metrics endpoint) set, terragucci estate sends one batch of gauges, labelled project. The estate’s own values carry project="*". The Estate dashboard graphs them in its Delivery row.
| Gauge | Labels |
|---|---|
terragucci_dora_deployments_per_week |
project |
terragucci_dora_lead_time_seconds |
project, segment: total, before_gate, at_gate, after_gate |
terragucci_dora_change_failure_ratio |
project |
terragucci_dora_restore_seconds |
project |
A metric with nothing to count, such as a lead time with no plan found, is not sent. Traces and metrics covers the collector and the dashboards.
Policy metrics
Section titled “Policy metrics”The same run writes the policy metrics to policy-metrics.json beside dora.json and to the Policy section of estate.html. They come from audit.jsonl alone, except drift, which comes from the tf-drift rows of each index.json. Use them to watch a rule while it is advisory or overridable before you make it mandatory. The window and the weeks are the ones the DORA metrics use.
| Metric | terragucci counts | From |
|---|---|---|
| Denials | roots a wave’s policy denied, counted once per wave plan (project, gate, set digest and root) however often the wave ran | refused entries with result denied-by-policy (detail.denied), and the overrides of apply entries |
| Denials per rule | each denial once under every rule id it names; a denial with no rule id counts under (no rule id) |
detail.rules of those entries |
| Override rate | denials an override let through, over all denials | apply entries whose overrides name the root |
| Override turnaround | the median and the longest time from a denial recorded for an override to the first override of that root and digest | override-requested and override entries |
| Open and expired requests | a request with no override is open until its expires, then expired; open requests show their median and oldest age |
override-requested entries and detail.expires |
| Revoked overrides | overrides a commit removed from the ledger | override-revoked entries |
| Blocked before deploy | refused waves, once per project, gate, set digest and reason, by reason | refused entries |
| Found after | failed applies, state versions written outside terragucci, and drift incidents found by drift checks | apply entries with result failed, unrecorded-write entries, and tf-drift rows |
| Blocked share | blocked before deploy over blocked plus found after | the two rows above |
Every count is of events in the window, and open requests are counted as of the run. A denial a wave recorded before the window and ran into again inside it counts at its first time, so it stays outside.
policy-metrics.json
Section titled “policy-metrics.json”policy-metrics.json is terragucci.policy-metrics/v1.
| Field | What it holds |
|---|---|
generated, weeks, window |
when it was built, how many weeks it covers, and the first Monday and the end |
audit |
whether audit.jsonl was read; without it nothing but drift counts |
drift |
whether drift checks were read; without them found_after.drift is null |
estate |
the metrics across every project |
projects[] |
each project’s metrics, with project |
Each set of metrics holds:
| Field | What it holds |
|---|---|
denials, overridden, override_rate |
denials in the window, how many an override let through, and the ratio; override_rate is null with no denial |
rules[] |
rule, denials and overridden, most denials first |
requests |
requested, overridden, open, expired, revoked, turnaround_median_seconds, turnaround_max_seconds, open_age_median_seconds, open_age_max_seconds |
blocked |
waves, policy (denied by the policy), other, and by_reason, the count for each refused result |
found_after |
failed_applies, unrecorded_writes, drift and total |
blocked_share |
blocked.waves over itself plus found_after.total; null when both are zero |
trend[] |
a row per week, oldest first: week, denials, overridden, override_rate, overrides (written to the ledger that week), blocked, found_after |
terragucciHelp setting it up: Intentius
These docs count page views and clicks with PostHog. They set no cookies, store nothing in your browser, and send nothing when your browser asks not to be tracked.