diff --git a/status-messages/src/status_messages.py b/status-messages/src/status_messages.py index 40aba677..ff0c28f8 100644 --- a/status-messages/src/status_messages.py +++ b/status-messages/src/status_messages.py @@ -2,6 +2,7 @@ import os from datetime import datetime, timezone +from pathlib import Path import boto3 from mattermostdriver import Driver @@ -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(