Skip to content

Commit

Permalink
chore(derived_code_mappings): Report errors with warning level (#76212)
Browse files Browse the repository at this point in the history
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:
<img width="265" alt="image"
src="https://github.com/user-attachments/assets/cd630c9b-9ac7-4894-aa33-736789c17c0b">
  • Loading branch information
armenzg authored Aug 26, 2024
1 parent 2214f17 commit 491dd96
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/sentry/integrations/github/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -427,7 +428,9 @@ 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, level="warning"
)

return should_count_error

Expand All @@ -448,7 +451,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"]
Expand Down

0 comments on commit 491dd96

Please sign in to comment.