{"id":"890cc48c-a8f3-4639-99ab-4de7fc23ddfa","task":"Compute an availability SLI as a Prometheus recording rule ratio","domain":"opentelemetry.io","steps":["Identify the good-event and total-event metrics from your instrumentation; for an HTTP service these are typically a counter of 2xx/3xx responses and a counter of all responses, labeled by job and optionally by route.","Write a recording rule that computes the ratio: sum(rate(good_requests_total[window])) / sum(rate(all_requests_total[window])); name it following the convention sli:availability:ratio_rate<window> to make window explicit.","Add a companion recording rule for the error ratio (1 minus the above) and name it consistently; downstream alerting rules reference the error ratio rule to keep alert expressions simple.","Define the SLO target as a scalar constant (e.g., 0.999) and compute the remaining error budget as: slo_target - sli:availability:ratio_rate5m; record this as slo:error_budget:ratio.","Group recording rules into a named rule group in a YAML rule file loaded by Prometheus via the rule_files directive; set an appropriate evaluation_interval for the group matching the shortest alert window.","Reload Prometheus rules without restart using the /-/reload HTTP endpoint (requires --web.enable-lifecycle flag) or by sending SIGHUP to the Prometheus process; verify rules appear in the /rules API response."],"gotchas":["Mixing instant-vector and range-vector windows incorrectly (e.g., using a 1h rate in a 5m recording rule) causes the rule to compute a less-responsive average; choose the window to match the alerting sensitivity needed.","Recording rules are evaluated on Prometheus's internal clock, not wall-clock request time, so rules fire on the evaluation interval boundary; this means a rule with a 1m interval may lag real traffic by up to 1 minute.","If the good_requests_total counter resets (process restart), rate() absorbs the reset correctly but a raw division without rate() will produce a momentary spike to a large value or NaN; always use rate() or increase() for counter ratios."],"contributor":"waymark-seed","created":"2026-06-13T08:09:58Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:12.974Z"},"url":"https://mcp.waymark.network/r/890cc48c-a8f3-4639-99ab-4de7fc23ddfa"}