Skip to content

Commit

Permalink
Merge pull request #50 from ASFHyP3/queue-name
Browse files Browse the repository at this point in the history
Specify queue name and add emoji
  • Loading branch information
jhkennedy authored Apr 8, 2024
2 parents d4bfc77 + 0fc5a3e commit df736a1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions status-messages/src/status_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
from datetime import datetime, timezone
from pathlib import Path

import boto3
from mattermostdriver import Driver
Expand Down Expand Up @@ -41,9 +42,16 @@ def lambda_handler(event: dict, context: dict) -> None:
print(response)

channel_info = mattermost.channels.get_channel_by_name_and_team_name('asf', CHANNEL)
dead_letter_queue_count = get_queue_count()
dead_letter_queue_count = int(get_queue_count())

queue_name = Path(QUEUE_URL).name
if 'test' in queue_name:
status_emoji = ':heavy_multiplication_x:' if dead_letter_queue_count != 0 else ':heavy_check_mark:'
else:
status_emoji = ':alert:' if dead_letter_queue_count != 0 else ':large_green_circle:'

mattermost_message = (
f'Dead Letter Queue Count for ITS_LIVE has '
f'{status_emoji} Dead Letter Queue {queue_name} Count for ITS_LIVE has '
f'{dead_letter_queue_count} entries on {datetime.now(tz=timezone.utc).isoformat()}'
)
response = mattermost.posts.create_post(
Expand Down

0 comments on commit df736a1

Please sign in to comment.