Skip to content

Commit

Permalink
fix(admin): Print SENTRY_ENVIRONMENT to slack (#6307)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
untitaker authored Sep 16, 2024
1 parent 68b4ebd commit acbd3e0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion snuba/admin/notifications/slack/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from typing import Any, Dict, List, Optional, Union

from snuba import settings
Expand Down Expand Up @@ -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}>*",
}
],
}

0 comments on commit acbd3e0

Please sign in to comment.