Some checks are pending
build-images / api (push) Waiting to run
build-images / worker-gpu (push) Waiting to run
build-images / web (push) Waiting to run
codeql / Analyze (javascript-typescript) (push) Waiting to run
codeql / Analyze (python) (push) Waiting to run
perf / API hot-path micro-smoke (budgeted) (push) Waiting to run
perf / Desktop engine crates (release build check) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Waiting to run
vision2026-ci / API phase modules (ruff + pytest) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Waiting to run
vision2026-ci / Python SDK resource tests (push) Waiting to run
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Waiting to run
vision2026-ci / Alembic upgrade + drift check (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Waiting to run
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
37 lines
1.7 KiB
Bash
Executable File
37 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Post-canary SLO gate — queries Prometheus for the error-rate + the wallet
|
|
# success-only-billing invariant over the recent window and fails (non-zero) if
|
|
# either breaches, so the deploy pipeline halts the promote and triggers rollback.
|
|
#
|
|
# Usage: verify-slos.sh <namespace> <window> e.g. verify-slos.sh reelforge 5m
|
|
set -euo pipefail
|
|
|
|
NAMESPACE="${1:-reelforge}"
|
|
WINDOW="${2:-5m}"
|
|
PROM="${PROM_URL:-http://prometheus.${NAMESPACE}.svc:9090}"
|
|
|
|
# Max tolerated 5xx rate during canary (fraction of requests).
|
|
MAX_ERROR_RATE="${MAX_ERROR_RATE:-0.02}"
|
|
|
|
query() {
|
|
# Returns the scalar value of a Prometheus instant query (0 if empty/null).
|
|
curl -sf --max-time 15 "${PROM}/api/v1/query" --data-urlencode "query=$1" \
|
|
| grep -oE '"value":\[[0-9.]+,"[-0-9.eE]+"\]' \
|
|
| grep -oE '"[-0-9.eE]+"\]$' | tr -dc '0-9.eE-' || echo "0"
|
|
}
|
|
|
|
fail() { echo "::error::SLO gate failed: $1"; exit 1; }
|
|
|
|
echo "verifying SLOs over ${WINDOW} for ${NAMESPACE} via ${PROM}"
|
|
|
|
# 1) API 5xx error rate.
|
|
err_rate=$(query "sum(rate(http_requests_total{status=~\"5..\",namespace=\"${NAMESPACE}\"}[${WINDOW}])) / clamp_min(sum(rate(http_requests_total{namespace=\"${NAMESPACE}\"}[${WINDOW}])),1)")
|
|
awk "BEGIN{exit !(${err_rate:-0} <= ${MAX_ERROR_RATE})}" \
|
|
|| fail "5xx error rate ${err_rate} > ${MAX_ERROR_RATE}"
|
|
|
|
# 2) Wallet success-only-billing invariant: paid debits with zero completed renders.
|
|
bad_billing=$(query "increase(wallet_debit_micros{reason=\"generation\"}[${WINDOW}]) > bool 0 and increase(render_jobs{state=\"COMPLETED\"}[${WINDOW}]) == bool 0")
|
|
[ "${bad_billing:-0}" = "1" ] && fail "wallet success-only-billing invariant breached (pay-double risk)"
|
|
|
|
echo "SLO gate passed: error_rate=${err_rate:-0} billing_invariant=ok"
|