From 4a448fbb0d0b416fef9ee0ab26579e0dc16f21b7 Mon Sep 17 00:00:00 2001 From: Christinarlong <60594860+Christinarlong@users.noreply.github.com> Date: Fri, 25 Oct 2024 10:56:46 -0700 Subject: [PATCH] chore(sentry apps): Adjust logs when we dont have a url (#79779) --- .../external_requests/select_requester.py | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/sentry/sentry_apps/external_requests/select_requester.py b/src/sentry/sentry_apps/external_requests/select_requester.py index 67f11b3b16c72e..b7e746811f3e7b 100644 --- a/src/sentry/sentry_apps/external_requests/select_requester.py +++ b/src/sentry/sentry_apps/external_requests/select_requester.py @@ -50,16 +50,27 @@ def run(self) -> dict[str, Any]: response = json.loads(body) except Exception as e: - logger.info( - "select-requester.error", - extra={ - "sentry_app_slug": self.sentry_app.slug, - "install_uuid": self.install.uuid, - "project_slug": self.project_slug, - "error_message": str(e), - "url": url, - }, - ) + extra = { + "sentry_app_slug": self.sentry_app.slug, + "install_uuid": self.install.uuid, + "project_slug": self.project_slug, + "error_message": str(e), + } + + if not url: + extra.update( + { + "uri": self.uri, + "dependent_data": self.dependent_data, + "webhook_url": self.sentry_app.webhook_url, + } + ) + message = "select-requester.missing-url" + else: + extra.update({"url": url}) + message = "select-requester.request-failed" + + logger.info(message, extra=extra) raise APIError from e if not self._validate_response(response):