Operational Remediation Reports
Atomic Budget Remediation Report
Spend a contention budget against a fixed capacity and turn the granted and denied counts into a spend, drain, or throttle remediation action.
budget capacity
The contention capacity and budget are scalars, so the granted and denied counts that drive the remediation action stay deterministic and free of atomic identity.
Atomic Budget Remediation Report
atomic_budget_remediation_report.cpp
Replay: real traced execution (multi-file project)
#include <iostream>
#include <string>
int main() {
int requests = 1;
const int capacity = 2;
int granted = 0;
int denied = 0;
for (int i = 0; i < requests; ++i) {
if (granted < capacity) {
granted += 1;
} else {
denied += 1;
}
}
int spare = capacity - granted;
std::string action;
if (denied > 0) {
action = "throttle";
} else if (spare == 0) {
action = "drain";
} else {
action = "spend";
}
std::cout << "requests=" << requests
<< " granted=" << granted
<< " denied=" << denied
<< " " << action << std::endl;
return 0;
}
#include <iostream>
#include <string>
int main() {
int requests = 2;
const int capacity = 2;
int granted = 0;
int denied = 0;
for (int i = 0; i < requests; ++i) {
if (granted < capacity) {
granted += 1;
} else {
denied += 1;
}
}
int spare = capacity - granted;
std::string action;
if (denied > 0) {
action = "throttle";
} else if (spare == 0) {
action = "drain";
} else {
action = "spend";
}
std::cout << "requests=" << requests
<< " granted=" << granted
<< " denied=" << denied
<< " " << action << std::endl;
return 0;
}
#include <iostream>
#include <string>
int main() {
int requests = 4;
const int capacity = 2;
int granted = 0;
int denied = 0;
for (int i = 0; i < requests; ++i) {
if (granted < capacity) {
granted += 1;
} else {
denied += 1;
}
}
int spare = capacity - granted;
std::string action;
if (denied > 0) {
action = "throttle";
} else if (spare == 0) {
action = "drain";
} else {
action = "spend";
}
std::cout << "requests=" << requests
<< " granted=" << granted
<< " denied=" << denied
<< " " << action << std::endl;
return 0;
}
requests ← 1, capacity ← 2, granted ← 0, denied ← 0
4int main() {5 int requests→ 1 = 1; //@requests=2, 46 const int capacity→ 2 = 2;7 int granted→ 0 = 0;8 int denied→ 0 = 0;for (int i = 0; i < requests; ++i)
10for (int i0 = 0; i < requests1; ++i) {11 if (granted < capacity) {granted ← 1
10for (int i = 0; i < requests; ++i) {11 if (granted0 < capacity2) {12 granted→ 1 += 1;13 } else {spare ← 1, action ← (empty)
16}17int spare→ 1 = capacity2 - granted1;1819std::string action→ (empty);20if (denied > 0) {action ← spend
23 action = "drain";24} else {25 action→ spend = "spend";26}std::cout << "requests=" << requests
28 std::cout << "requests=" << requests129 << " granted=" << granted130 << " denied=" << denied031 << " " << actionspend << std::endl;32 return 0;33}outputrequests=1 granted=1 denied=0 spend
requests ← 2, capacity ← 2, granted ← 0, denied ← 0
4int main() {5 int requests→ 2 = 2;6 const int capacity→ 2 = 2;7 int granted→ 0 = 0;8 int denied→ 0 = 0;for (int i = 0; i < requests; ++i)
pass 1 of 210for (int i0 = 0; i < requests2; ++i) {11 if (granted < capacity) {granted ← 1
pass 1 of 210for (int i = 0; i < requests; ++i) {11 if (granted0 < capacity2) {12 granted→ 1 += 1;13 } else {for (int i = 0; i < requests; ++i)
pass 2 of 210for (int i1 = 0; i < requests2; ++i) {11 if (granted < capacity) {granted ← 2
pass 2 of 210for (int i = 0; i < requests; ++i) {11 if (granted1 < capacity2) {12 granted→ 2 += 1;13 } else {spare ← 0, action ← (empty)
16}17int spare→ 0 = capacity2 - granted2;1819std::string action→ (empty);20if (denied > 0) {action ← drain
21 action = "throttle";22} else if (spare0 == 0) {23 action→ drain = "drain";24} else {std::cout << "requests=" << requests
28 std::cout << "requests=" << requests229 << " granted=" << granted230 << " denied=" << denied031 << " " << actiondrain << std::endl;32 return 0;33}outputrequests=2 granted=2 denied=0 drain
requests ← 4, capacity ← 2, granted ← 0, denied ← 0
4int main() {5 int requests→ 4 = 4;6 const int capacity→ 2 = 2;7 int granted→ 0 = 0;8 int denied→ 0 = 0;for (int i = 0; i < requests; ++i)
pass 1 of 410for (int i0 = 0; i < requests4; ++i) {11 if (granted < capacity) {All 4 passes — pass 1 is the card above pass icapacitygranteddenied1 0 2 0 → 1 — 2 1 2 1 → 2 — 3 2 — — 0 → 1 4 3 — — 1 → 2 granted ← 1
pass 1 of 210for (int i = 0; i < requests; ++i) {11 if (granted0 < capacity2) {12 granted→ 1 += 1;13 } else {granted ← 2
pass 2 of 210for (int i = 0; i < requests; ++i) {11 if (granted1 < capacity2) {12 granted→ 2 += 1;13 } else {denied ← 1
pass 1 of 212 granted += 1;13} else {14 denied→ 1 += 1;15}denied ← 2
pass 2 of 212 granted += 1;13} else {14 denied→ 2 += 1;15}spare ← 0, action ← (empty)
16}17int spare→ 0 = capacity2 - granted2;1819std::string action→ (empty);20if (denied > 0) {action ← throttle
19std::string action;20if (denied2 > 0) {21 action→ throttle = "throttle";22} else if (spare == 0) {std::cout << "requests=" << requests
28 std::cout << "requests=" << requests429 << " granted=" << granted230 << " denied=" << denied231 << " " << actionthrottle << std::endl;32 return 0;33}outputrequests=4 granted=2 denied=2 throttle