Health SLOs and incident response
What you will learn
Reliability must be expressed from the user perspective. A service-level indicator measures outcomes; an objective defines the target over a window. Health probes are operational signals, not a replacement for measuring user-visible success.
- Distinguish liveness, readiness and request success.
- Calculate a request-based SLI, error budget and burn rate from synthetic counts.
- Write a runbook and blameless postmortem with verifiable follow-up.
Plain Java examples: save as Main.java in a fresh directory, then run javac --release 21 Main.java and java Main. Standalone Java 21 models; the companion telemetry configuration is source-reviewed, not executed.
Separate readiness and liveness
public class Main { record State(boolean loopHealthy,boolean accepting) {} static String probes(State s) { return "live="+s.loopHealthy()+", ready="+(s.loopHealthy()&&s.accepting()); } public static void main(String[] args) { for(var s:new State[]{new State(true,true),new State(true,false),new State(false,false)}) System.out.println(probes(s)); }}Expected output:
live=true, ready=truelive=true, ready=falselive=false, ready=falseThe middle state drains traffic without asking the supervisor to restart the process. It models policy rather than actually probing Actuator.
Health probes
Liveness answers whether restart may be necessary; readiness answers whether this instance should receive work. A shared database outage should not automatically fail every liveness probe and trigger restart storms. Include dependencies in readiness only after considering the effect of taking all instances out of routing. Spring Boot Actuator exposes health groups such as /actuator/health/liveness and /actuator/health/readiness. Expose only required endpoints on a protected management interface; do not publish env, configprops, heapdump, or raw diagnostics. A healthy process can still return slow or incorrect responses.
SLI, SLO and error budget
Define eligible requests, good outcomes, measurement source and time window. Example fictional SLO: at least 99.9% of eligible catalog reads over 30 days return correct data within 300 ms. With 10,000 eligible requests, budget is 10 bad requests. If 25 are bad, SLI = 99.75%, the budget is exceeded by 15, and the observed bad fraction divided by 0.001 gives a burn rate of 2.5. Use counts from the same window, distinguish rate from budget consumed and never use a zero-request window as evidence of 100% success. Real burn-rate alerts combine long and short windows; thresholds should be tied to response urgency. SLA is an agreement, not the same as an internal objective.
Incident response and learning
The companion incident is a fictional catalog degradation. First verify the user-facing SLI and scope; assign incident coordination and communication roles; inspect bounded metrics and sampled traces for hypotheses. Mitigate using an approved rollback or feature flag, then verify recovery against the SLI, not just an instance health flag. Record observed facts, assumptions and unknowns separately. A blameless postmortem documents impact, contributing conditions, detection gaps, mitigation, and action items with owners and acceptance criteria. Do not paste sensitive logs, tokens, query values or heap dumps. Read the companion runbook for a tabletop exercise; no actual incident or production telemetry is claimed.
Calculate synthetic request error budget
public class Main { record Report(java.math.BigDecimal sliPercent,long allowed,long remaining,java.math.BigDecimal burn) {} static Report report(long total,long bad) { if(total<=0 || bad<0 || bad>total) throw new IllegalArgumentException("invalid counts"); var t=java.math.BigDecimal.valueOf(total); var b=java.math.BigDecimal.valueOf(bad); var rounding=java.math.RoundingMode.HALF_UP; return new Report(t.subtract(b).multiply(java.math.BigDecimal.valueOf(100)).divide(t,2,rounding), total/1000,total/1000-bad,b.multiply(java.math.BigDecimal.valueOf(1000)).divide(t,2,rounding)); } public static void main(String[] args) { var r=report(10000,25); System.out.println(r); }}Expected output:
Report[sliPercent=99.75, allowed=10, remaining=-15, burn=2.50]At 99.9% target, integer permitted failures use floor(total/1000). The rounded display must not be used for exact pass/fail decisions.
Combine window alerts with minimum traffic
public class Main { static boolean page(long shortTotal,long shortBad,long longTotal,long longBad) { return shortTotal>=100 && longTotal>=100 && 1000.0*shortBad/shortTotal>=10 && 1000.0*longBad/longTotal>=10; } public static void main(String[] args) { System.out.println(page(1000,20,10000,150)); System.out.println(page(1000,20,10000,5)); System.out.println(page(0,0,10000,150)); }}Expected output:
truefalsefalseThis fictional simplified policy requires burn rate ≥10 in both windows plus minimum counts. Missing traffic needs a separate telemetry/no-data check, not a success signal. Real alerts must be calibrated to the service and chosen windows.
Common mistakes
Do not average instance percentages, restart healthy processes merely because a shared dependency is down, or declare an incident resolved based on liveness. A request SLO must specify which requests qualify and what good means.
Practice
For a 99.5% request target, calculate allowed bad requests and remaining budget for 2,000 requests with 8 failures. Print 10 then 2. Reject counts outside the valid range.
Expected output:
102Compare with the manual review criteria.
Further reading: Health · SLO · Postmortem. Independent editorial review remains pending.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Health SLOs and incident response — knowledge check
Observability and reliability reasoning.
What should liveness usually avoid?
What is a request SLI?
What is a 99.9% budget for 10,000 requests?
How interpret zero eligible requests?
What belongs in a postmortem?