From acbd3e0ac02270ced8b01ea8a53ac71b9dc88fc0 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Mon, 16 Sep 2024 17:34:18 +0200 Subject: [PATCH] fix(admin): Print SENTRY_ENVIRONMENT to slack (#6307) The slack messages already contain the admin URL which identifies the region, but let's print it explicitly as well. SENTRY_ENVIRONMENT corresponds to the region. --- snuba/admin/notifications/slack/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/snuba/admin/notifications/slack/utils.py b/snuba/admin/notifications/slack/utils.py index 037f0036c4..ae817eb2e2 100644 --- a/snuba/admin/notifications/slack/utils.py +++ b/snuba/admin/notifications/slack/utils.py @@ -1,3 +1,4 @@ +import os from typing import Any, Dict, List, Optional, Union from snuba import settings @@ -95,12 +96,13 @@ def build_context( user: str, timestamp: str, action: AuditLogAction ) -> Dict[str, Union[str, List[Dict[str, str]]]]: url = f"{settings.ADMIN_URL}/#auditlog" + environ = os.environ.get("SENTRY_ENVIRONMENT") or "unknown environment" return { "type": "context", "elements": [ { "type": "mrkdwn", - "text": f"{action.value} at *<{url}|{timestamp}>* by *<{user}>*", + "text": f"{action.value} at *<{url}|{timestamp}>* by *<{user}>* in *<{environ}>*", } ], }