Cost Management tooling demo · 2026-09-05
An API timeout, a stalled worker, or queue lag can be caused by many layers:
Each layer answers a different question. None, by itself, is the root cause.
What it gives us
Example: a Gunicorn WORKER TIMEOUT is an anchor for a narrow log and RDS search window — it is not proof that PostgreSQL timed out.
WORKER TIMEOUT
# Retain the event detail locally scripts/glitchtip-snapshot \ --events <issue-id> \ reports/glitchtip-events.json # Then investigate with the reusable workflow $investigate-alert <issue-url>
Question answered: Is this new, recurring, isolated, or broad?
Check before forming a database theory
kubectl --context <explicit-prod-context> \ -n hccm-prod get pods kubectl --context <explicit-prod-context> \ -n hccm-prod logs <pod> --since=15m
Evidence: process health and the application’s last known action.
Pod logs are immediate but narrow. Kibana lets us search a bounded time range across replicas for the alert's tenant, provider, task, or message.
scripts/kibana-search --environment prod \ --query '"WORKER TIMEOUT"' \ --from 2026-09-04T12:37:00Z \ --to 2026-09-04T12:41:00Z --size 20 \ | jq -r '.responses[].hits.hits[]._source | "\(.["@timestamp"])\t\(.["@log_stream"])\t\(.["@message"])"' \ | rg --color=always 'WORKER TIMEOUT'
scripts/cost-prod-rds-postgresql-logs \ --around 2026-09-04T12:39:05Z \ --window-seconds 180 \ --all-events \ --output reports/rds-alert-window
still waiting
--all-events matters: it includes errors, lock waits, and deadlocks, not only the slow-query records selected by the default mode.
--all-events
EXPLAIN (COSTS, VERBOSE, BUFFERS, FORMAT JSON) SELECT ...;
scripts/gabi-explain-json query.sql \ --output reports/query-plan.json
This captures the planner estimate through the read-only gabi-cli connection.
gabi-cli
Question answered: Where does PostgreSQL expect the work, and what data shape or index could change it?
scripts/pev2-report \ --title 'Cost report aggregation — comparison' \ --plan baseline=reports/baseline.json \ --plan optimized=reports/optimized.json \ --output reports/comparison.html
ANALYZE
investigate-alert
scripts/kibana-search
scripts/cost-prod-rds-postgresql-logs --all-events
scripts/gabi-explain-json
scripts/pev2-report
The tools preserve raw evidence locally, while the runbook captures how to use it safely and consistently.
open reports/comparison.html
Click the visualization to open the interactive PEV2 comparison.