From 897c1ab476ae96baabe3a657de56f29c82e90512 Mon Sep 17 00:00:00 2001 From: "Armen Zambrano G." <44410+armenzg@users.noreply.github.com> Date: Thu, 29 Aug 2024 08:26:09 -0400 Subject: [PATCH] chore(derived_code_mappings): Report known issues as non-errors (#76616) This reports the exceptions as warning-level errors rather than error-level. Deployments do not get paused if the error is [warning or lower](https://github.com/getsentry/getsentry/blob/b08907d9da3e8856c6cbedbd86d4a722c6f89dd9/gocd/templates/bash/backend/check-sentry-new-errors.sh#L12): ``` --additional-query="issue.type:error !level:info !level:warning" ``` Rendering of a warning-level exception: image PS: This is a redo of #76212 but without passing a level, thus, making it an info-level message. --- src/sentry/integrations/github/client.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sentry/integrations/github/client.py b/src/sentry/integrations/github/client.py index 4c2591c4335573..012a4d99a1dfa5 100644 --- a/src/sentry/integrations/github/client.py +++ b/src/sentry/integrations/github/client.py @@ -8,6 +8,7 @@ import orjson import sentry_sdk from requests import PreparedRequest +from sentry_sdk import capture_exception, capture_message from sentry.constants import ObjectStatus from sentry.integrations.github.blame import ( @@ -427,7 +428,7 @@ def _populate_trees_process_error(self, error: ApiError, extra: dict[str, str]) else: # We do not raise the exception so we can keep iterating through the repos. # Nevertheless, investigate the error to determine if we should abort the processing - logger.error("Continuing execution. Investigate: %s", error_message, extra=extra) + capture_message("Continuing execution. Investigate: %s", error_message, extra=extra) return should_count_error @@ -448,7 +449,8 @@ def _populate_trees(self, repositories: list[dict[str, str]]) -> dict[str, RepoT except ApiError: only_use_cache = True # Report so we can investigate - logger.exception("Loading trees from cache. Execution will continue. Check logs.") + logger.warning("Loading trees from cache. Execution will continue. Check logs.") + capture_exception(level="warning") for index, repo_info in enumerate(repositories): repo_full_name = repo_info["full_name"]