Operational Reliability Reports
Capacity Reserve Reliability
Label Margins
Capacity reports are easier to review when demand, reserve, and a threshold label appear in one result.
Program
Play the script to choose the minimum reserve and inspect which services stay above the margin.
capacity_reserve_reliability_report.sql
CREATE TABLE service_capacity (service TEXT, demand INTEGER, capacity INTEGER);
INSERT INTO service_capacity VALUES ('api', 72, 100), ('batch', 88, 100), ('search', 95, 100);
WITH params(min_reserve) AS (VALUES ()), reserves AS (SELECT service, capacity - demand AS reserve FROM service_capacity) SELECT service, reserve, CASE WHEN reserve >= (SELECT min_reserve FROM params) THEN 'ok' ELSE 'tight' END AS capacity_status FROM reserves ORDER BY service;
CREATE TABLE service_capacity (service TEXT, demand INTEGER, capacity INTEGER);
INSERT INTO service_capacity VALUES ('api', 72, 100), ('batch', 88, 100), ('search', 95, 100);
WITH params(min_reserve) AS (VALUES ()), reserves AS (SELECT service, capacity - demand AS reserve FROM service_capacity) SELECT service, reserve, CASE WHEN reserve >= (SELECT min_reserve FROM params) THEN 'ok' ELSE 'tight' END AS capacity_status FROM reserves ORDER BY service;
CREATE TABLE service_capacity (service TEXT, demand INTEGER, capacity INTEGER);
INSERT INTO service_capacity VALUES ('api', 72, 100), ('batch', 88, 100), ('search', 95, 100);
WITH params(min_reserve) AS (VALUES ()), reserves AS (SELECT service, capacity - demand AS reserve FROM service_capacity) SELECT service, reserve, CASE WHEN reserve >= (SELECT min_reserve FROM params) THEN 'ok' ELSE 'tight' END AS capacity_status FROM reserves ORDER BY service;
reserve
Reserve is derived from fixed capacity minus fixed demand.
margin selector
`min_reserve` changes the policy threshold without changing the fixture rows.
report label
The final result labels each service as ok or tight.