Skip to content

🤖 Alert if Sentry Usage Over Threshold #320

🤖 Alert if Sentry Usage Over Threshold

🤖 Alert if Sentry Usage Over Threshold #320

name: 🤖 Alert if Sentry Usage Over Threshold
on:
schedule:
- cron: "0 6 * * *"
workflow_dispatch:
inputs:
period_in_days:
description: "Period in days"
required: false
type: string
usage_threshold:
description: "Usage threshold (%)"
required: false
type: string
jobs:
sentry-usage-alert:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: "3.11"
cache: "pipenv"
- name: Install Pipenv
run: |
pip install pipenv
pipenv install
- run: pipenv run python -m bin.sentry_usage_alert
env:
SENTRY_TOKEN: ${{ secrets.SENTRY_TOKEN }}
SLACK_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
PERIOD_IN_DAYS: ${{ inputs.period_in_days }}
USAGE_THRESHOLD: ${{ inputs.usage_threshold }}
LOGGING_LEVEL: ${{ secrets.LOGGING_LEVEL }}
KPI_DASHBOARD_URL: ${{ secrets.KPI_DASHBOARD_PROD_URL }}
KPI_DASHBOARD_API_KEY: ${{ secrets.KPI_DASHBOARD_PROD_API_KEY }}
- name: Report failure to Slack
if: always()
uses: ravsamhq/notify-slack-action@472601e839b758e36c455b5d3e5e1a217d4807bd # 2.5.0
with:
status: ${{ job.status }}
notify_when: "failure"
notification_title: "Failed GitHub Action Run: Sentry Usage Alert"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}