Skip to content

Commit

Permalink
formatting slack messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kerrychu committed Jan 23, 2024
1 parent aaf60a3 commit fb96ef5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions quota.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ def monitor():
for project_id in PROJECT_IDs:
raw_quota = get_fileset_quota(project_id)
quota_record = stdout_to_quota_records(raw_quota)
usage = round(int(quota_record[ "Used Storage (GB)"]) / int(quota_record["Storage Limit (GB)"]), 2)
slack_message = "💿 Current State of Quota\n" + f"usage percentage: {usage * 100}%"
usage = round(
int(quota_record["Used Storage (GB)"])
/ int(quota_record["Storage Limit (GB)"]),
2,
)
slack_message = "💿 Current State of Quota\n"
for key, value in quota_record.items():
slack_message += f"⦿ {key}: {value}\n"
slack_message += f"👉🏼 Usage Percentage (GB): {usage * 100}%"
send_slack_message(message=slack_message, webhook=SLACK_WEBHOOK)


Expand Down

0 comments on commit fb96ef5

Please sign in to comment.