Skip to content

Sentry: ignore logging known exceptions #8919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions readthedocs/projects/tasks/builds.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
DuplicatedBuildError,
ProjectBuildsSkippedError,
YAMLParseError,
MkDocsYAMLParseError,
)
from readthedocs.doc_builder.loader import get_builder_class
from readthedocs.doc_builder.python_environments import Conda, Virtualenv
Expand All @@ -62,7 +63,7 @@
from readthedocs.worker import app


from ..exceptions import RepositoryError
from ..exceptions import RepositoryError, ProjectConfigurationError
from ..models import APIProject, Feature, WebHookEvent, HTMLFile, ImportedFile, Project
from ..signals import (
after_build,
Expand Down Expand Up @@ -220,12 +221,21 @@ class UpdateDocsTask(SyncRepositoryMixin, Task):
max_retries = 5 # 5 per normal builds, 25 per concurrency limited
default_retry_delay = 7 * 60

# Expected exceptions that will be logged as info only and not retried
# Expected exceptions that will be logged as info only and not retried.
# These exceptions are not sent to Sentry either because we are using
# ``SENTRY_CELERY_IGNORE_EXPECTED=True``.
#
# All exceptions generated by a user miss-configuration should be listed
# here. Actually, every subclass of ``BuildUserError``.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this future proof too? Like, any subclasses of BuildUserError are already included here with the superclass in the throws list?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is 100% clear to me. Sentry docs does not specify if indicating the superclass is enough to avoid sending their subclasses as an error as well. So, I'm specifying all of them for now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, not sure if there is a good way to test it. However, we want all BuildUserError to not be reported to Sentry because we know it's not our fault. The "problem" is that we need to specify all the classes here, which may be a little tedious, but that's fine, I guess.

throws = (
DuplicatedBuildError,
ProjectBuildsSkippedError,
ConfigError,
YAMLParseError,
BuildUserError,
RepositoryError,
MkDocsYAMLParseError,
ProjectConfigurationError,
)

acks_late = True
Expand Down