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

Reduce logging to sentry #5054

Merged
merged 1 commit into from
Jan 3, 2019
Merged

Reduce logging to sentry #5054

merged 1 commit into from
Jan 3, 2019

Conversation

dojutsu-user
Copy link
Member

Related Issues - #4978, #3856, #4590,

@dojutsu-user
Copy link
Member Author

Are the exceptions defined in readthedocs.doc_builder.exceptions and readthedocs.projects.exceptions are to be exempted from the logging in the same way?

@dojutsu-user dojutsu-user changed the title Reducing logging to sentry Reduce logging to sentry Jan 2, 2019
@@ -266,6 +266,9 @@ def USE_PROMOS(self): # noqa
},
}

# Sentry
SENTRY_CELERY_IGNORE_EXPECTED = True
Copy link
Member

Choose a reason for hiding this comment

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

This setting comes from https://docs.sentry.io/clients/python/integrations/django/#additional-settings (just linking for reference)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you.
I should have added this in the description.

@stsewd stsewd requested review from humitos and a team January 2, 2019 15:57
@ericholscher
Copy link
Member

Looks good. Thanks!

@ericholscher ericholscher merged commit 171b45c into readthedocs:master Jan 3, 2019
@dojutsu-user dojutsu-user deleted the reduce-logging-to-sentry branch January 3, 2019 05:45
@humitos
Copy link
Member

humitos commented Jan 3, 2019

I suppose that we should remove the logic that I wrote some time ago if we are going in this direction:

https://github.com/rtfd/readthedocs.org/blob/77f9d8720a82a6d5ef2295795297dd7df6cbc37b/readthedocs/doc_builder/environments.py#L477-L486

@humitos
Copy link
Member

humitos commented Jan 3, 2019

Or, at least, we should think about what to do with them. Also, does Celery provides a way to "log them as WARNING" or it does log them but do not send them to Sentry only?

@dojutsu-user
Copy link
Member Author

dojutsu-user commented Jan 3, 2019

With ref to comment:
Celery does log them but as INFO (also, no traceback is provided).

I tried making a simple task with celery and using task.throws.
I used this example

# tasks.py
from celery import Celery

app = Celery('tasks', broker='pyamqp://guest@localhost//')

@app.task(throws=(ZeroDivisionError,))
def divide(x, y):
    if y == 0:
        raise ZeroDivisionError("Divide by zero")
    return x/y

And when i tried divide.delay(4,0), i get this:

[2019-01-03 15:06:08,893: INFO/MainProcess] Received task: tasks.divide[eadc9b77-208b-460b-8cce-a891812a5895]  
[2019-01-03 15:06:08,897: INFO/ForkPoolWorker-2] Task tasks.divide[eadc9b77-208b-460b-8cce-a891812a5895] raised expected: ZeroDivisionError('Divide by zero',)

And as per the Sentry docs, this must not be logged.

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

Successfully merging this pull request may close these issues.

4 participants