Skip to content

Commit

Permalink
differentiate test messages from prod
Browse files Browse the repository at this point in the history
  • Loading branch information
jhkennedy committed Apr 8, 2024
1 parent 3893cf1 commit 0fc5a3e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions status-messages/src/status_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +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()
alert_emoji = ':alert:' if dead_letter_queue_count != '0' else ':large_green_circle:'
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'{alert_emoji} Dead Letter Queue {Path(QUEUE_URL).name} 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 0fc5a3e

Please sign in to comment.