Some checks are pending
Check Python Version Consistency / Check Python Version (push) Waiting to run
1.8 KiB
1.8 KiB
Webhook / Chat-app oppsett
Budsjett-alerts og deploy-notifikasjoner sendes til en valgfri chat-app via en enkel webhook-URL lagret i Secret Manager.
Kompatible apper
| App | Webhook-format | Instruksjon |
|---|---|---|
| Google Chat | {"text": "..."} |
Rom → Apps → Webhooks → Legg til webhook |
| Slack | {"text": "..."} |
Apps → Incoming Webhooks → Add to Slack |
| Discord | {"content": "..."} |
Kanal-innstillinger → Integrations → Webhooks |
| Teams | {"text": "..."} |
Kanal → Connectors → Incoming Webhook |
Discord-merk: Discord bruker
contenti stedet fortext. Oppdatermain.pyi10-cost-guard.shogcloudbuild.yamlnotify-steget til{"content": "$MSG"}hvis du bruker Discord.
Legge til webhook URL
# Ny secret
gcloud secrets create webhook-url \
--data-file=<(echo -n "https://DIN-WEBHOOK-URL") \
--project=propane-will-491900-m5
# Oppdater eksisterende secret
gcloud secrets versions add webhook-url \
--data-file=<(echo -n "https://NY-WEBHOOK-URL") \
--project=propane-will-491900-m5
Hva utløser varsler
| Hendelse | Avsender | Terskel |
|---|---|---|
| Dev-budsjett 70% nådd | Cloud Function (10-cost-guard.sh) |
$52.50 av $75 |
| Dev-budsjett 90% nådd | Cloud Function | $67.50 av $75 |
| Prod-budsjett 50% nådd | Cloud Function | $250 av $500 |
| Prod-budsjett 80% nådd | Cloud Function | $400 av $500 |
| Budsjett 100% — auto-teardown | Cloud Function | Cloud Run stoppes |
| Deploy fullført | cloudbuild.yaml steg 5 |
Hver push til main |
Teste varsling manuelt
# Simuler 100% budsjett-alert (trigger auto-teardown)
gcloud pubsub topics publish billing-alert-auto-teardown \
--message='{"budgetAmount":75,"costAmount":75,"alertThresholdExceeded":1.0}' \
--project=propane-will-491900-m5