Skip to content

CICD-359 · SLO compliance checking ​

Encyclopedia · Observability and SRE pipelines · All snippets

Previous · CICD-358 · Next · CICD-360

1. Where it fits ​

  • Placement CI run step or authorized lab terminal.
  • Prerequisites staging metrics stack, provisioned endpoints and read-only CI identity except explicitly approved writes.
  • Platforms local-linux, github-actions, gitea-actions.
  • Parameters PROM_URL.

2. Copy the snippet ​

bash
curl -fsSG "${PROM_URL:?}/api/v1/query" --data-urlencode 'query=slo:sli_ratio_30d{service="web"}' | jq -e '.data.result | length==1 and (.[0].value[1]|tonumber) >= 0.999'

3. How it works ​

The query expects a unique numeric sample for the long-window SLI. jq rejects no data, multiple series and ratios below the threshold.

4. Verify the result ​

Requires a recording rule and an explicit no-data policy. This fails closed on no sample or ambiguous series.

Validation syntax-validated (Bash parse). Status definitions.