Просмотр исходного кода

chore(slack): better error logs when opening modal (#66608)

Cathy Teng 1 год назад
Родитель
Сommit
3278ec9051
1 измененных файлов с 25 добавлено и 6 удалено
  1. 25 6
      src/sentry/integrations/slack/webhooks/action.py

+ 25 - 6
src/sentry/integrations/slack/webhooks/action.py

@@ -388,7 +388,8 @@ class SlackActionEndpoint(Endpoint):
         # but seems like there's no other solutions [1]:
         #
         # [1]: https://stackoverflow.com/questions/46629852/update-a-bot-message-after-responding-to-a-slack-dialog#comment80795670_46629852
-        use_block_kit = features.has("organizations:slack-block-kit", group.project.organization)
+        org = group.project.organization
+        use_block_kit = features.has("organizations:slack-block-kit", org)
         callback_id = {
             "issue": group.id,
             "orig_response_url": slack_request.data["response_url"],
@@ -423,13 +424,27 @@ class SlackActionEndpoint(Endpoint):
                 headers = {"content-type": "application/json; charset=utf-8"}
                 slack_client.post("/views.open", data=json.dumps(payload), headers=headers)
             except ApiError as e:
-                logger.exception("slack.action.response-error", extra={"error": str(e)})
+                logger.exception(
+                    "slack.action.response-error",
+                    extra={
+                        "error": str(e),
+                        "organization_id": org.id,
+                        "integration_id": slack_request.integration.id,
+                    },
+                )
 
         else:
             try:
                 slack_client.post("/dialog.open", data=payload)
             except ApiError as e:
-                logger.exception("slack.action.response-error", extra={"error": str(e)})
+                logger.exception(
+                    "slack.action.response-error",
+                    extra={
+                        "error": str(e),
+                        "organization_id": org.id,
+                        "integration_id": slack_request.integration.id,
+                    },
+                )
 
     def open_archive_dialog(self, slack_request: SlackActionRequest, group: Group) -> None:
         callback_id = {
@@ -781,9 +796,13 @@ class SlackActionEndpoint(Endpoint):
             if org_context:
                 use_block_kit = any(
                     [
-                        True
-                        if features.has("organizations:slack-block-kit", org_context.organization)
-                        else False
+                        (
+                            True
+                            if features.has(
+                                "organizations:slack-block-kit", org_context.organization
+                            )
+                            else False
+                        )
                         for oi in org_integrations
                     ]
                 )