Around Go: DevOps and reliability · 3 MIN READ

Use an SLO to decide when an incident needs attention

Define eligible events, compute error-budget burn and require both recent and sustained evidence before paging.

An SLI measures a user-relevant outcome; an SLO defines the intended level over a stated window. Error-budget burn relates the observed bad-event fraction to the allowed fraction. It can connect delivery decisions to reliability evidence more usefully than paging on every CPU spike.

Go for DevOps and reliability · A MAP OF THE IDEA

  1. Define eligible user outcomes
  2. Measure bad and total events
  3. Compare sustained and recent burn
  4. Respond and verify recovery

Useful when

  • Define eligible events, compute error-budget burn and require both recent and sustained evidence before paging.
  • Make changes reviewable and verify the result against the original contract.

Watch out

  • No observations mean missing evidence, not demonstrated health. Define eligible events and require appropriate sustained and recent signals before alerting.

Implementation & operation cost: Automation needs explicit ownership, bounded privileges, tests and recovery evidence; a shorter command is not sufficient.

01

Write the denominator before the dashboard

For a request-driven API, state which requests are eligible, what counts as bad, the latency boundary if any and the measurement point. A timeout observed by the caller may be invisible in a server’s completed-request counter. Do not exclude difficult traffic just to improve the number. Business rejections, client cancellation and internal failures need an explicit classification agreed with the service contract. Version that definition when it changes.

02

Calculate burn in a bounded model

For target 99.9%, the allowed bad-event fraction is 0.001. An observed 2% bad-event fraction burns that budget at about 20 times its sustainable rate. The example requires both windows to pass the configured threshold, and rejects an empty denominator rather than calling missing telemetry healthy. The chosen threshold is an exercise input, not a universal paging policy.

go
package main

import (
 "errors"
 "fmt"
 "math"
)
type Window struct { Total, Bad uint64 }
func burn(w Window, target float64) (float64, error) {
 if math.IsNaN(target) || math.IsInf(target, 0) || target <= 0 || target >= 1 || w.Total == 0 || w.Bad > w.Total { return 0, errors.New("invalid or missing evidence") }
 return (float64(w.Bad) / float64(w.Total)) / (1 - target), nil
}
func page(long, short Window, target, threshold float64) (bool, error) {
 if math.IsNaN(threshold) || math.IsInf(threshold, 0) || threshold <= 0 { return false, errors.New("invalid threshold") }
 a, err := burn(long, target); if err != nil { return false, err }
 b, err := burn(short, target); if err != nil { return false, err }
 return a >= threshold && b >= threshold, nil
}
func main() {
 high := Window{Total: 10000, Bad: 200}
 rate, _ := burn(high, 0.999)
 alert, _ := page(high, high, 0.999, 14.4)
 recovered, _ := page(high, Window{Total: 1000}, 0.999, 14.4)
 _, missing := burn(Window{}, 0.999)
 fmt.Printf("burn %.1fx page %t recovered %t missing %t\n", rate, alert, recovered, missing != nil)
}
Read the code

Expected output: burn 20.0x page true recovered false missing true. Both window samples are explicit input data; they are not collected automatically from a real monitoring system. Use tolerances when asserting floating-point rates.

03

Combine time windows with a response contract

A long window captures significant consumption, while a short window confirms the problem is still active. Windows, thresholds and minimum event volume depend on the service and response time; a low-traffic service may need additional signals and careful sampling. Write down who receives the alert, the symptom, evidence links and a first safe action. Separate an urgent user-impacting page from a capacity-planning ticket.

04

Keep telemetry bounded and useful

For a Go HTTP service, count eligible outcomes and record latency with stable operation labels. Avoid user IDs, raw URLs, request bodies, secrets and unbounded error strings as metric labels. Correlate structured logs and traces without treating either as a substitute for an aggregate SLI. A per-instance health probe answers a routing/process question; it is not automatically the service-level user outcome.

05

Rehearse one page and one recovery

Feed a sustained high-error sample, a brief spike, a recovered short window, zero observations and impossible counters into the model. Verify that missing evidence is visibly unavailable. Explain why each scenario pages or does not. Add a small load test in a disposable native service, observe the real route and compare client timeouts with server outcomes. Preserve the incident timeline and tune the policy from those observations, rather than muting unexplained alerts.

TAKE THIS WITH YOU

Define eligible events, compute error-budget burn and require both recent and sustained evidence before paging.

Check your understanding

What does error-budget burn compare?

Go to the source

Progress stays in this browser. No account needed.