Skip to content
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

Internal django-q errors are not ignored #14

Open
whyscream opened this issue Jul 19, 2023 · 0 comments
Open

Internal django-q errors are not ignored #14

whyscream opened this issue Jul 19, 2023 · 0 comments

Comments

@whyscream
Copy link

An attempt is made to ignore internal logging from Django-Q itself in

# Important to not log the logger.error nessages from django-q
# We only want to catch the exceptions, not the logger
ignore_logger('django-q')
. Introduced in #4.

This doesn't seem to work however: in Sentry I'm receiving ERROR log messages about failed tasks in Django (generated at https://github.com/django-q2/django-q2/blob/7fb7fca176eceb5112196b6620cd336a616124df/django_q/monitor.py#L57-L65)

After some research I'm now trying to suppress these in a Sentry before_send hook:

def before_send(event, hint):
    """Suppress certain events from being submitted to Sentry"""
    if "log_record" in hint:
        rec = hint["log_record"]
        if rec.name == "django-q":
            # See https://github.com/django-q2/django-q2/blob/7fb7fca176eceb5112196b6620cd336a616124df/django_q/monitor.py#L58  # noqa: E501
            logger.info("Suppressing Sentry event submission for Django-Q internals")
            return None

    return event

It would be nice if this would work out if the box.

@whyscream whyscream changed the title django-q-sentry does not ignore internal django-q errors Internal django-q errors are not ignored Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant